Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Modern Perl: The Book: The Draft

by morgon (Deacon)
on Jul 25, 2010 at 09:31 UTC ( #851246=note: print w/ replies, xml ) Need Help??


in reply to Modern Perl: The Book: The Draft

Just a tiny thing (or maybe just a matter of taste):

In Chapter 10 "Easy File Slurping", you use this idiom for slurping:

my $file = do { local $/ = <$fh> };

For me the assignment to the localized $/ (that is done just so that the do-block returns the file-content) is confusing.

Clearer (for me):

my $file = do { local $/; <$fh> };


Comment on Re: Modern Perl: The Book: The Draft
Select or Download Code
Re^2: Modern Perl: The Book: The Draft
by chromatic (Archbishop) on Jul 25, 2010 at 21:42 UTC

    I've seen both idioms, so both deserve an explanation. Thanks for the suggestion; how would you like me to credit you?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (10)
As of 2014-12-29 14:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (190 votes), past polls