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