Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (13)
As of 2014-09-23 12:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (220 votes), past polls