Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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?
[Discipulus]: listen monks: do you think is possible to realize here at pm some kind of collaborative works? beyond ask & answer, i mean
[Tanktalus]: isn't that what github, sourceforge, gitlabs, etc., are for?
[Discipulus]: mmh.. i was no strictly thinking to programs; more on some new tutorials

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2017-09-22 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (269 votes). Check out past polls.

    Notices?