> This works as intended...
> 
> my $arg1 = "c:/my_scripts/file.txt";
> my $arg2 = "c:/my_scripts/another.txt";
> my $program = "c:/my_scripts/cheese.pl";
> my @args = ($arg1, $arg2);
> exec "$program @args";
> 
> HOWEVER, I cannot for the life of me get the following to 
> work, no matter what I try with \"s etc. Is it actually possible?
> 
> my $arg1 = "c:/my scripts/file.txt";
> my $arg2 = "c:/my scripts/another.txt";
> my $program = "c:/my scripts/cheese.pl";
> my @args = ($arg1, $arg2);
> exec "$program @args";

Let me first comment that most of the time when I see people want to use
exec, they really want system() or backticks, perhaps followed by an exit.
At least you'd be able to determine success or capture any error messages,
which I believe would clue you in to the problem. Additionally, people
trying to use exec, system, or backticks on another perl script are usually
better off with include/require/use, sometimes combined with a little OO
refactoring. :-)

That being said, the only difference I see in your two examples is that the
second one has a space in an argument, which will be seen by the shell as
two arguments. You will need to escape it like "my\\ scripts" so that a
literal backslash gets through to the shell.


-- 
Mark Thomas                    [EMAIL PROTECTED] 
Internet Systems Architect     DigitalNet, Inc. 

$_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; 
  

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

Reply via email to