Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Capturing input from pipe?

by ariels (Curate)
on May 01, 2001 at 14:20 UTC ( [id://76913]=note: print w/replies, xml ) Need Help??


in reply to Capturing input from pipe?

If you want to read only the standard input, you can read the predefined filehandle STDIN. For instance, to add line numbers to all lines coming from your pipe, you could do this:
#!/usr/local/bin/perl -w use strict; while (<STDIN>) { print "$. $_" }

But almost any program is more useful if it can read either STDIN or filenames supplied on the command line. So reading <> almost always makes more sense.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-19 05:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found