cybermack72 has asked for the wisdom of the Perl Monks concerning the following question:
I'm reading a serverlist into an array and per/server issuing commands. One of those commands is a mapping command, forwhich I'm trying to use:system ("net use j\:\\\\\$server\\c\$...etc.
in my foreach statement I first print the $server to ensure it's reading the list (it is), but I get "Network error 53...when it tries to map the drive using the command above......this is a script run on Win32 mapping to Win32 machines.
Re: Variables in system calls
by kwoff (Friar) on Dec 13, 2001 at 02:38 UTC
|
I'd put the string into a variable, then print that to
see what the command actually being passed is.
I assume you also tried it from the command-line without
a perl script. | [reply] |
(tye)Re: Variables in system calls
by tye (Sage) on Dec 13, 2001 at 09:14 UTC
|
my $share= '//'.$server.'/c$';
$share =~ tr#/#\\#;
system( "net use j: $share ..." );
that way you don't have to count backslashes and don't need a backslash in front of the '$'.
-
tye
(but my friends call me "Tye") | [reply] [d/l] |
Re: Variables in system calls
by Fastolfe (Vicar) on Dec 13, 2001 at 03:24 UTC
|
I think you have one-too-many back-slashes before $server. Do what the other poster suggested and print out the string you're using here. | [reply] [d/l] |
Re: Variables in system calls
by strat (Canon) on Dec 13, 2001 at 16:10 UTC
|
I always use the module Win32::NetResource; in combination with Win32::WinError it is rather easy to use.
Best regards,
perl -e "print a|r,p|d=>b|p=>chr 3**2 .7=>t and t" | [reply] [d/l] |
|