Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: Looping through a file, reading each line, and adding keys/editing values of a hash

by GrandFather (Saint)
on Dec 05, 2013 at 20:47 UTC ( [id://1065842]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Looping through a file, reading each line, and adding keys/editing values of a hash
in thread Looping through a file, reading each line, and adding keys/editing values of a hash

I know its strongly favoured by many. I don't understand why.

My strong preference is to use pre-increment where possible so the increment operator is more easily seen (trailing stuff is more easily ignored). But maybe I'm missing something important about the post-increment?

A very minor consideration may be that the post-increment could be slower for some implementations that the pre-increment. The difference is so slight that it would be exceptionally unusual for that to be a consideration.

True laziness is hard work
  • Comment on Re^4: Looping through a file, reading each line, and adding keys/editing values of a hash

Replies are listed 'Best First'.
Re^5: Looping through a file, reading each line, and adding keys/editing values of a hash
by choroba (Cardinal) on Dec 06, 2013 at 17:10 UTC
    In void context, Perl agrees with you:
    $ perl -MO=Deparse -e '$x++' ++$x;
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-19 16:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found