Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Common Perl Pitfalls

by JavaFan (Canon)
on Apr 10, 2012 at 23:32 UTC ( #964422=note: print w/ replies, xml ) Need Help??


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

Considering that Joe_'s example uses the handle INPUTFILE, I don't have any problems with the implication, and I really don't see the need to come up with the snobby term correct idiom. (You consider a piece of code with error handling to be correct idiom? You're fired).

I really like the second one, thanks. Not for production use, of course. :)
Why not? It's not significant different from your correct idiom. It misses error handling (but then, so does your correct idiom), but that's easily handled: just add a // die "slurp: $!";.


Comment on Re^3: Common Perl Pitfalls
Select or Download Code
Re^4: Common Perl Pitfalls
by dwalin (Monk) on Apr 10, 2012 at 23:50 UTC

    Considering that Joe_'s example uses a handle and your last two use filename, it could be confusing for a novice.

    Why I wouldn't use the second example in production? Readability. Not everybody is familiar with intimate relationship between @ARGV and <>, and this solution doesn't really give any advantage over the common one.

    P.S. As for your show-off harshness, I care less for anti-snobs than I do for snobs. You didn't hire me, you have no authority to fire me. Have a good day sir.

    Regards,
    Alex.

      Not everybody
      Ah, but I don't have to write my production code for everybody. At best, only a hundred or so eyes will see my production code before it's obsolete or rewritten.
        Well, I would consider myself lucky if I could afford writing production code knowing that only people smarter than me will ever see it. Not there yet, if ever.

        Regards,
        Alex.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2014-09-21 02:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (166 votes), past polls