I have a hash which contains a list of array and i have to get a unique list from that array . But when i am trying to id i am not getting any error or the unique list.
NOTE : I don't want to use any module.
Below is the sample structure of my hash which has the array :
'15445' => { 'str' => {
'TOKEN' => [
'HC',
'HC',
'HC',
'HC',
'HC',
'HC'
]
}
}
How i am tying to get a unique list of values from the array TOKEN
foreach my $id (keys %$client) {
my @unique_srp_id;
@unique_srp_id = uniq($hash->{$id}->{str}->{TOKEN});
print @unique_srp_id;
}
sub uniq {
my %seen;
grep !$seen{$_}++, @_;
}
Can anyone suggest me what wrong i am doing here.
uniq
. – ikegami Feb 12 at 1:46