http://www.perlmonks.org?node_id=1055790


in reply to Re^2: How do I remove the duplicates from the array?
in thread How do I remove the duplicates from the array?

In that case you can add an else block to the code generating the arrays @output and @output1 in choroba's code.

my (@output, @output1); for my $i (0 .. $#array) { if (exists $hash{ $array[$i] } and $array1[$i] == $hash{ $array[$i] }{highest}) { push @output, $array[$i]; push @output1, $array1[$i]; } else { push @output, ''; # or use spaces ' ' here push @output1, ''; # or whatever you want } }