In Perl before 5.10 there is no \"state\" declaration.
I\'ve come across an example of creating static variables in these Perls: my $x if 0. The i
my $x if 0
i
No, it's very crummy. Use a closure instead.
use strict; sub add { my @arr; return sub { push @arr, '+'; print @arr, "\n"; } } my $iter = add(); $iter->() for 1..7;