in reply to Unique values in array

Hi Anonymous Monk.

Since you did not wish to print an array element that occured more than once (unique values only), this will work:

#!/usr/bin/perl -w use strict; my @array = ( 2, 4, 5, 5, 7, 8, 21, 22, 22, 30 ); my %count; foreach ( @array ) { $count{$_}++; } foreach ( @array ) { print "$_ " if $count{$_} < 2; } Output: 2 4 7 8 21 30

Hope this helps,
-Katie.