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

Re^6: Common Perl Pitfalls

by jdporter (Paladin)
on Apr 11, 2012 at 16:14 UTC ( [id://964569]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Common Perl Pitfalls
in thread Common Perl Pitfalls

half a day to type

You keep dwelling on that, but I think you're misdirecting. He wrote, "spend half a day writing and debugging code", not "half a day to type in one line".

If someone has a bug they need to track down, they're far more likely to waste cycles on a line like $_=do{local$/;<>}; than one like $_=read_file($file);

Now let's compare apples to apples:

use File::Slurp; my $text = read_file( 'filename' );
vs
my $text = do { local $/; open my $fh, '<', 'filename' or die "Error opening filename for read - $!"; <$fh> };

For most programmers, the former looks sane.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 23:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found