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;
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ