Perl Monk, Perl Meditation | |
PerlMonks |
Re^8: A short whishlist of Perl5 improvements leaping to Perl7by choroba (Cardinal) |
on Nov 30, 2020 at 16:54 UTC ( [id://11124405]=note: print w/replies, xml ) | Need Help?? |
I don't like state in named subroutines. It makes it hard to reïnitialise the variable and causes hard to debug problems. An anonymous sub is OK, because the state variable is reïnitialised every time the sub is created. But in this particular case, it's not highly probable you'd ever need to reïnitialise the variable. But, if you plan to convert from different digit systems, you'll quickly see why state is not the solution.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
In Section
Meditations
|
|