Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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> };

Replies are listed 'Best First'.
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 avoiding work at the Monastery: (5)
As of 2016-08-25 22:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (363 votes). Check out past polls.