Help for this page
use List::MoreUtils qw(indexes); my $a = '0157953'; ... substr $new, $_, 0, 'I' foreach ( indexes { $_ =~ /^[yz]$/ } split(//, $b) ); print $new, "\n";
substr $new, pos($b)-1, 0, 'I' while ( $b =~ /[yz]/g );