sub cleanup { my $i = shift; $i =~ s/.*=//s; $i =~ tr/01//cd; return [ split //, $i ] }
How about this?
sub cleanup { local $_ = shift; s/.*=//s; tr/01//cd; return [ split] }