erabus has asked for the wisdom of the Perl Monks concerning the following question:
use strict; my @people= ( {name=>'Bob'}, {name=>'Carol'} ); foreach my $i ( 0..$#people ) { if ( $people[$i]->{name} eq 'Bob' ) { $people[$i]->{name}='Robert'; # MODIFY $people[$i]->{age}=46; # ADD } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Modifying an array of hashes
by GrandFather (Saint) on Apr 06, 2011 at 21:04 UTC | |
by JavaFan (Canon) on Apr 06, 2011 at 21:24 UTC | |
by ikegami (Patriarch) on Apr 06, 2011 at 22:30 UTC | |
by believer (Sexton) on Apr 11, 2011 at 13:43 UTC | |
|
Re: Modifying an array of hashes
by ikegami (Patriarch) on Apr 06, 2011 at 22:37 UTC | |
|
Re: Modifying an array of hashes
by Anonymous Monk on Apr 07, 2011 at 01:06 UTC |