my @ary; while ( ) { chomp; push @ary, $_ and next if $_> 5; print; } __DATA__ 3 7 9 1 #### my %hash; while ( ) { chomp; $hash{$_}++ and next if $_ > 5; print; } __DATA__ 3 7 9 1