Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Perl Idioms Explained - my $string = do { local $/; };

by VSarkiss (Monsignor)
on Aug 29, 2003 at 15:25 UTC ( #287706=note: print w/replies, xml ) Need Help??


in reply to Perl Idioms Explained - my $string = do { local $/; <FILEHANDLE> };

One of the best explanations I've heard for $/ is due to TheDamian1:

$/ tells Perl when to stop reading.
So, when $/ has its default value of newline, Perl stops reading when it sees the newline character. When it's not defined, Perl doesn't stop reading until the end of the stream.

1I'm pretty sure of the source, but not 100%. If you have a correction, please let me know.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://287706]
help
Chatterbox?
[Discipulus]: good morning folks!
choroba mornings back
[Corion]: Hi choroba!
[Corion]: And Discipulus!
Corion arrived back from London. Always nice to meet people again, even if it's just once per year.
[Corion]: Also, dk contributed some cool stuff to App::ShaderToy, like menu settings and real fullscreen, eliminating many of my #TO-DO comments ;)
[Corion]: I hope you spent the four days well without me online ;-D

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2016-12-06 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (101 votes). Check out past polls.