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:
vsuse File::Slurp; my $text = read_file( 'filename' );
my $text = do { local $/; open my $fh, '<', 'filename' or die "Error opening filename for read - $!"; <$fh> };
For most programmers, the former looks sane.
|
|---|