in reply to persistent variables between subroutines (long)

If you're using perl 5.6, then this is exactly what the 'our' statement is for. It, like my, is local at the block level, but it accesses package variables rather than creating lexicals. So, for instance:
sub init { our ($foo); $foo = 0; } sub inc { our ($foo); $foo++; # same variable, $main::foo, as in init }
But:
sub dec { $foo++; # not allowed because $foo not declared }
So then, suppose you say:
init(); inc(); inc(); inc(); ($main::foo == 3) && print "Three!\n";
would print "Three!".