Re: access hash in specific sequence

2015-09-04 Thread Gary Stainburn
On Thursday 03 September 2015 21:50:54 Marius Gavrilescu wrote: > 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'; > >> f

Re: access hash in specific sequence

2015-09-03 Thread Uri Guttman
On 09/03/2015 04:50 PM, Marius Gavrilescu wrote: 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 { $pagetype

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{$_} } keys %pagetypes) { >> # do

Re: access hash in specific sequence

2015-09-03 Thread Gary Stainburn
On Thursday 03 September 2015 18:19:57 Marius Gavrilescu wrote: > gary.stainb...@ringways.co.uk (Gary Stainburn) writes: > > I am aware that you cannot define a key sequence when defining a hash. > > However, if I create a sequence field > > > > my %pagetypes=( > > 'Delivery Note'=>{'seq'=>1,w

Re: access hash in specific sequence

2015-09-03 Thread Charles DeRykus
On Thu, Sep 3, 2015 at 9:42 AM, Gary Stainburn wrote: > I have a hash of hashes which I converted to an array of hashes because I > needed to access them in a specific sequence. It now looks like > > my @pagetypes=( > {'pagetype'=>'Delivery Note','weight'=>2,. > {'pagetype'=>

Re: access hash in specific sequence

2015-09-03 Thread Shawn H Corey
On Thu, 3 Sep 2015 17:42:48 +0100 Gary Stainburn wrote: > I have a hash of hashes which I converted to an array of hashes > because I needed to access them in a specific sequence. It now looks > like > > my @pagetypes=( > {'pagetype'=>'Delivery Note','weight'=>2,. > {'pagetype'

Re: access hash in specific sequence

2015-09-03 Thread Marius Gavrilescu
gary.stainb...@ringways.co.uk (Gary Stainburn) writes: > I am aware that you cannot define a key sequence when defining a hash. > However, if I create a sequence field > > my %pagetypes=( > 'Delivery Note'=>{'seq'=>1,weight'=>2,. > 'Sales Invoice'=>{'seq'=>2,'weight'=>2,. >

Re: access hash in specific sequence

2015-09-03 Thread Shlomi Fish
Hi Gary, please reply to all recipients. On Thu, 3 Sep 2015 17:42:48 +0100 Gary Stainburn wrote: > I have a hash of hashes which I converted to an array of hashes because I > needed to access them in a specific sequence. It now looks like > > my @pagetypes=( > {'pagetype'=>'Delivery N

access hash in specific sequence

2015-09-03 Thread Gary Stainburn
I have a hash of hashes which I converted to an array of hashes because I needed to access them in a specific sequence. It now looks like my @pagetypes=( {'pagetype'=>'Delivery Note','weight'=>2,. {'pagetype'=>'Sales Invoice','weight'=>2,. {'pagetype'=>'Purchase