Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Modern Perl: The Book: The Draft

by morgon (Curate)
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?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2016-10-24 10:23 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (304 votes). Check out past polls.