944,150 Members | Top Members by Rank

Ad:
  • Perl Discussion Thread
  • Marked Solved
  • Views: 844
  • Perl RSS
Oct 6th, 2009
0

passing a path variable to system()

Expand Post »
Hi all,

I am new to Perl. I am trying to send a variable which contains the location of my executable (eg: C:\temp) to system function. i initialized the variable as,
my var1="C:\\temp";
when i print this line i got : C:\temp as o/p.
To start the executable i did:
system("$var1//executable.exe");
I thought, var1 is replaced with C:\temp, but not with C:\\temp
If i don't provide C:\\temp\\executable.exe to system(), the execution is not started.
I want to send a variable with two slashes to system function. Help me here. Or suggest me any work around
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rdevi is offline Offline
5 posts
since Sep 2009
Oct 6th, 2009
0

Passing a path

This will work in one of two ways


Change to:
my var1="C:\\\\temp";

And the do what you're doing.

Or, change to
my var1="C:/temp";

Which should work as well.
Reputation Points: 26
Solved Threads: 38
Posting Whiz in Training
mitchems is offline Offline
293 posts
since Feb 2009
Oct 7th, 2009
0
Re: passing a path variable to system()
Thank u
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rdevi is offline Offline
5 posts
since Sep 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Perl Forum Timeline: Difference between Dates
Next Thread in Perl Forum Timeline: How to copy a directory?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC