for (0..$#a) { if ($a[$_] eq 'a') { splice @a, $_, 1; last; # exit the for loop because only want to delete # the first match } }