Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 romping around the Monastery: (8)
As of 2014-08-28 02:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (255 votes), past polls