Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: How do I use the output of one perls script as the input of another on the commandline? like a pipeline

by ikegami (Pope)
on May 14, 2009 at 18:11 UTC ( #764164=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://764164]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2018-11-13 16:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (156 votes). Check out past polls.

    Notices?