Another way to do it:
$ perl -le' my @a = qw( 1 9 3 4 5 6 7 2 4 3 ); my @b = qw( x y z z a z z z b c ); my $char = "z"; my @anew; for my $i ( 0 .. $#b ) { if ( $b[ $i ] =~ ?^$char$? ) { push @anew, $a[ $i ]; } elsif ( $b[ $i ] =~ /^$char$/ ) { next; } else { push @anew, $a[ $i ]; reset; } } print "@anew"; ' 1 9 3 5 6 4 3
In reply to Re: delete multiple occurrences
by jwkrahn
in thread delete multiple occurrences
by coldy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |