in reply to Regular Expression and backquoted cmds
Does a backquoted command automatically get output to stdout as well as into the string $result?
No. You can't have the cake, and eat it too.
BTW, stderr is caught as well.
I think this gives you a nomination for the Useless Use Of Cat Award ;-) But from the Perl side, you might consider to assign to @result, not $result, because this spares you from using split afterwards. But don't forget to chomp the lines afterwards. You might also consider something like this:$result=`cat $file | anotherscript.pl`;
# Note: Code untested! my @none=grep { chomp; /NONE$/ } qx(anotherscript.pl <$file);
And don't forget to use strict and warnings....
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regular Expression and backquoted cmds
by JavaFan (Canon) on Feb 03, 2009 at 11:57 UTC | |
by rovf (Priest) on Feb 03, 2009 at 12:13 UTC |