my @c = ("bob", "bob", "martha", "bob"); for (my $i = 0; $i <= $#c; $i++) { if ($c[$i] eq "bob") { splice(@c,$i,1); $i--; } } print join ' ', @c;