Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: How to write a program to read stdin or command line?

by perrin (Chancellor)
on Oct 05, 2007 at 02:44 UTC ( #642815=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to write a program to read stdin or command line?
in thread How to write a program to read stdin or command line?

This is built-in behavior in Perl. From perlrun:
The null filehandle <> is special: it can be used to emulate the behavior of sed and awk. Input from <> comes either from standard input, or from each file listed on the command line. Here’s how it works: the first time <> is evaluated, the @ARGV array is checked, and if it is empty, $ARGV[0] is set to "-", which when opened gives you standard input. The @ARGV array is then processed as a list of filenames.
  • Comment on Re^3: How to write a program to read stdin or command line?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://642815]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2016-12-10 22:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (165 votes). Check out past polls.