Nevermind...stupid yet subtle mistake...
I wasnt chomping the result from STDIN... should have done this:
chomp($filename=<STDIN>);
this removes the newline character which kept getting inserted into $filename, giving $filename a value such as '/path/file\n', and thus passing the newline into my $cmd string, making $cmd look like this:
$cmd = "mycmd -args $filename >outfile" ...gives...
"mycmd -args /path/file\n >outfile"
So, everytime I passed $cmd to system(), it would execute the cmd and stop at the newline character embedded within $filename, thus skipping the ">outfile" redirection...
problem solved, but thanks to everyone for pointing out that this apparently should have worked.
Please add this to your vast collection of mental "gotchas" that can stump users... | [reply] |