http://www.perlmonks.org?node_id=1039156


in reply to Question on Reading a file inside while and counting no.of lines

vyeddula,

There's a difference between $count++ and ++$count.

The first one increments it after using it (ie. prints its value first, and then adds one). The second increments it before using it.

Try using ++$count instead, and you should see the answer you expect.

Look at the first example in "Auto-increment and Auto-decrement" here.

say  substr+lc crypt(qw $i3 SI$),4,5