use 5.030;
use warnings;
####
$ alias perle
alias perle='perl -Mstrict -Mwarnings -Mautodie=:all -MCarp::Always -E'
####
$ perl -v | head -2 | tail -1
This is perl 5, version 32, subversion 0 (v5.32.0) built for cygwin-thread-multi
####
$ perle '
say counter() for 1..3;
sub counter {
state $add;
$add += $_ for (1..5);
return $add;
}
'
15
30
45
####
$ perle '
my $add;
for (1..3) {
$add = counter();
say "... other processing here ...";
say $add;
}
sub counter {
state $add;
$add += $_ for (1..5);
return $add;
}
'
... other processing here ...
15
... other processing here ...
30
... other processing here ...
45