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


in reply to Re^2: understanding closures
in thread understanding closures

reasonablekeith,
Here is a clue - what happens when you forget about closures and run the following code?
#!/usr/bin/perl use strict; use warnings; my $cnt = 0; print $cnt++, "\n"; print $cnt++, "\n"; print $cnt += 10, "\n"; print $cnt++, "\n"; print $cnt++, "\n";
The ++ operator (see perlop) first retrieves the current value and then increments the value when used as post-increment.

Cheers - L~R