You are using a single quote. 

2 options.

Use double quotes:
my $outdir = "\\\\ldn1dta1\\summitreports\\mark-it\\dev\\";

remove the extra back slashes: either of these should work.  
my $outdir = '\\ldn1dta1\summitreports\mark-it\dev\';
my $outdir = '\\\\ldn1dta1\summitreports\mark-it\dev\';

I would recommend using the double quotes, because of how the single
quote does the literal translation, however it does allow you to escape
chars using the single /.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Wednesday, July 21, 2004 9:39 AM
To: [EMAIL PROTECTED]
Subject: Backslashes and system:

I have a string containing a directory:

my $outdir = '\\\\ldn1dta1\\summitreports\\mark-it\\dev\\';

I then concantenate this with a command eg:

my $cmd = "command ".$outdir."filename.txt";

print $cmd;
Gives command \\ldn1dta1\summitreports\mark-it\dev\filename.txt
As expected.


When I try to execute this using system:

system ($cmd);

It gives an error cos it has stripped the backslashes again:

Error command \ldn1dta1summitreportsmark-itdevfilename.txt
Cant find file etc...

What is going on here!



______________________________________________________________
This message may contain privileged information. If you have received
this message by mistake, please keep it confidential and return it to
the sender.

Although we have taken steps to minimise the risk of transmitting
software viruses, the EBRD accepts no liability for any loss or damage
caused by computer viruses and would advise you to carry out your own
virus checks. 
The contents of this e-mail do not necessarily represent the views of
the EBRD.
______________________________________________________________

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to