http://www.perlmonks.org?node_id=764164


in reply to How do I use the output of one perls script as the input of another on the commandline? like a pipeline

Pipes sends the data to the program's standard input, so you need:
#!/usr/bin/perl while (<STDIN>) { chomp; print "$_ and two\n"; }

But it's better to use the following since <> is more flexible. It reads from STDIN unless file names are specified on the command line (in which case it reads the named files instead).

#!/usr/bin/perl while (<>) { chomp; print "$_ and two\n"; }
  • Comment on Re: How do I use the output of one perls script as the input of another on the commandline? like a pipeline
  • Select or Download Code