I am really going crazy here. I have the following system call that I
would like to run from perl:
  "ls *.txt | xargs cat > out"
if *.txt does not exist then I expect to get an exit code different
from 0.

So to test I do:

use strict;

my $f = "file_which_does_not_exist";

# method 1
print "test 1\n";
qx(ls $f | xargs cat);
print $?,"\n";

#method 2
print "test 2\n";
system("ls $f | xargs cat");
print $?,"\n";

Both calls return 0  instead of returning error as 'ls' fails.
Help. How do I do this ?
Would 'open' help ?

C.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to