use strict; use warnings; my @arry = (9,0,0,5,3,0,0,0,2,0,1,0); print "@arry \n"; @arry = grep {$_} @arry; print "@arry \n";