On Thu, 3 Sep 2015 17:42:48 +0100
Gary Stainburn <gary.stainb...@ringways.co.uk> 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'=>'Sales Invoice','weight'=>2,.....
>       {'pagetype'=>'Purchase Invoice','weight'=>2,.....  
> ..........
> 
> I then access the array using
> 
> foreach my $pt (@pagetypes) {

Each item of the array is a reference to a hash. It helps if you add
the suffix `_href` for hash references (and `_aref` for array
references).


    foreach my $pt_href ( @pagetypes ){
        my $pagetype = $pt_href->{pagetype};


-- 
Don't stop where the ink does.
        Shawn

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to