- or download this
use strict;
use warnings;
...
my @unique = grep {$tally{$_} == 1} keys %tally;
print "Unique keys:\n";
print "$_\n" for sort @unique;
- or download this
if ($tally{2} == 1) {
print "2 is unique\n";
}
- or download this
my $a = '12345678901';
my $cnt = $a =~ tr/1//;
#In this case $cnt = 2, which means it is not unique