in reply to Re: Get one element from anonymous hash
in thread Get one element from anonymous hash

What if I need to add an element to it?
  • Comment on Re^2: Get one element from anonymous hash

Replies are listed 'Best First'.
Re^3: Get one element from anonymous hash
by NetWallah (Canon) on Mar 23, 2014 at 23:59 UTC
    You have an "Array of hash-refs" - usually referred to as AOH.

    Adding data is like adding to the end of an array:

    push @data, { 'firstname' => 'Suzy', 'lastname' => 'Wong', 'id' => '5253', 'email' => 'test2@test.com', 'date' => '04/03/2014', 'olddate' => '04-23-2013', 'page' => 'no page', };

            What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
                  -Larry Wall, 1992

Re^3: Get one element from anonymous hash
by Anonymous Monk on Mar 24, 2014 at 00:01 UTC
    for my $i (0 .. $#data) { $data[$i]{'stuff'} = 'more stuff'; }