Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: file processing, while and foreach: a n00b experience

by wirrwarr (Monk)
on Aug 27, 2003 at 12:20 UTC ( [id://287017]=note: print w/replies, xml ) Need Help??


in reply to file processing, while and foreach: a n00b experience

It should be emphasized that the argument to foreach is evaluated in list context, while the argument to while is evaluated in scalar context. This means that foreach (<FH>) is (roughly) equivalent to
my @x = <FH>; foreach (@x) { ... }
And this code does slurp the whole file into memory first.

daniel.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-04-24 04:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found