in reply to How to read in data with pipe characters
That's an error you're getting due to bash, not Perl. You tell bash to call "/try.pl" with the argument 'a', and pipe the result into b, its result into c, and that result into d./try.pl a|b|c|d bash: b: command not found bash: c: command not found bash: d: command not found
You probably want /try.pl 'a|b|c|d'. But, we aren't done. Once you have 'a|b|c|d', you feed it back into a shell. So, again, you need to escape it, but putting quotes around $_.
But why are you writing a Perl program which all it does it take input, and feed the input back to another shell? Why not just:
However, if you do write it in Perl, why both the backticks, and system? Do you even know what the backticks do? Now you are saying: "Perl, please start a shell, and execute the command I'm giving you. Gather the output, and starts a second shell, executing whatever was written to STDOUT by the first shell." Is that really your intention?#!/usr/bin/sh echo $1 > /tmp/gerbil.txt
|
|---|