Re: access hash in specific sequence

2015-09-03 Thread Marius Gavrilescu
gary.stainb...@ringways.co.uk (Gary Stainburn) writes: > On Thursday 03 September 2015 18:19:57 Marius Gavrilescu wrote: >> The above can be shortened using the Sort::Key module. >> >> use Sort::Key 'nkeysort'; >> for my $key (nkeysort { $pagetypes{$_}

Re: access hash in specific sequence

2015-09-03 Thread Marius Gavrilescu
sort. for my $key (sort { $pagetypes{$a}{seq} <=> $pagetypes{$b}{seq} } keys %pagetypes) { # do stuff with $pagetypes{key} here } The above can be shortened using the Sort::Key module. use Sort::Key 'nkeysort'; for my $key (nkeysort { $pagetypes{$_} } keys %page

Re: Perl array question

2015-05-06 Thread Marius Gavrilescu
27;,'1902-6','1902-7','1902-8'); my %hash; for (@arr) { my ($earfcn, $pcid) = split /-/; next unless $pcid; # Skip the NULLs $hash{$earfcn} //= []; push @{$hash{$earfcn}}, $pcid; } for my $earfcn (keys %hash) { say "EARFCN=$earfcn,PCID=", join '&', @{$hash{$earfcn}}; } -- Marius Gavrilescu signature.asc Description: PGP signature