in reply to Understanding how sort uniq works
use strict; use warnings; use List::Util qw(uniq); use Data::Dumper; my $line = 'k,g,a,v,f,c'; my $href = { v => ['foo'], }; my ($k,$g,$a,$v,$f,$c) = split(/,/,$line); push(@{$href->{v}},$a); @{$href->{v}} = sort(uniq(@{$href->{v}})); # Compare to your Case II print Dumper($href);
|
|---|