Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 (Patriarch)
on May 14, 2009 at 22:11 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://764164]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2026-03-08 21:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.