passing a path variable to system()

Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Sep 2009
Posts: 5
Reputation: rdevi is an unknown quantity at this point 
Solved Threads: 0
rdevi rdevi is offline Offline
Newbie Poster

passing a path variable to system()

 
0
  #1
Oct 6th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 57
Reputation: mitchems is an unknown quantity at this point 
Solved Threads: 2
mitchems's Avatar
mitchems mitchems is offline Offline
Junior Poster in Training

Passing a path

 
0
  #2
Oct 6th, 2009
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.
And don't tell me there isn't one bit of difference between null and space, because that's exactly how much difference there is.

Larry Wall
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 5
Reputation: rdevi is an unknown quantity at this point 
Solved Threads: 0
rdevi rdevi is offline Offline
Newbie Poster
 
0
  #3
Oct 7th, 2009
Thank u
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC