sub increaseNumber { my $value = 001 return $value + 1 };
Every time you call that sub, you (re)set $value to one.
If you did it this way:
my $value = 1; sub increaseNumber { return ++$value; };
It would work as you want.
Why post pseudo-code rather than proper Perl?
In reply to Re: increasing value every time sub routine called
by BrowserUk
in thread increasing value every time sub routine called
by bigmoose
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |