for my $i ( reverse 0 .. $#ARGV ) { splice( @ARGV, $i, 1 ) if $ARGV[$i] eq 'hello'; }