in reply to Making a variable in a sub retain its value between calls

You might want to take a look at This Node

What I generally do if I need to recycle a variable in a sub routine is just call the variable at the beginning of the script.
#!/usr/bin/perl use warnings; use strict; my $counter = 0; &mySub; &mySub; &mySub; sub mySub { print "My Value is ", $counter++, "\n"; }
Since $counter exists before the sub is called, the sub inherits the variable and updating it should work fine.