I have on a windows machine (with perl interpreter on environmental path) the command :
perl script1.pl | perl script2.pl
and the contents of script one are just:
print "AAA";
and the contents of script 2 is just:
$r = shift;
print $r;
And the command doesn’t pipe correctly. How do you do this? Also,
if you were to do it with a Filehandle, how would you run a perl script from another script concurrently. The following doesn’t work:
open F, '| perl script2.pl AAA';
Remember that
shiftin your main program removes elements from the special array@ARGVthat holds the current invocation’s command-line arguments.Write script2 as a filter
or even
To set up the pipeline from script1, use
Multi-argument
openbypasses the shell’s argument parsing—an excellent idea on Windows. The code above assumes both scripts are in the current directory. Output: