use strict; use warnings; my @arry = qw ( 1 5 5 5 5 2 ); my $i = 0; print "@arry\n"; @arry = grep { $_ != 5 } @arry; print "@arry\n";