alincoln has asked for the wisdom of the Perl Monks concerning the following question:
my $gxmlConfigObjt = new XML::Simple( forcearray => 1 ,keyattr => {} ,rootname => 'feedback' ); # OPEN : Open the file... # my $gxmlConfigDoc = $gxmlConfigObjt->XMLin( $gxmlConfigFile );
.$gxmlConfigDoc = { . 'item' => [ . { 'zip-code' => ['03036'] . ,'city' => ['Chester'] . ,'name' => ['Adym S. Lincoln'] . ,'address' => ['123 Lane Road'] . ,'state' => ['NH'] . }, . { 'zip-code' => ['03103'] . ,'city' => ['Manchester'] . ,'name' => ['Joseph C. Lincoln'] . ,'address' => ['1050 Perimeter Road'] . ,'state' => ['NH'] . } . ] .};
$gxmlConfigDoc{item}[++$#{gxmlConfigDoc{item}}] = { 'zip-code' => ['01880'], 'city' => ['Wakefield'], 'name' => ['Whatdb'], 'address' => ['20 Harvard Mill S +q'], 'state' => ['MA'] }; #$gxmlConfigDoc{item} = { 'item' => [ # { # 'zip-code' => ['01880'], # 'city' => ['Wakefield'], # 'name' => ['Whatdb'], # 'address' => ['20 Harvard Mill +Sq'], # 'state' => ['MA'] # } # ] # }; #push @{ $gxmlConfigDoc{item} }, # 'item' => [ # { # 'zip-code' => ['01880'], # 'city' => ['Wakefield'], # 'name' => ['Whatdb'], # 'address' => ['20 Harvard Mill Sq'], # 'state' => ['MA'] # } # ] #;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Adding elements to hashes of arrays...
by broquaint (Abbot) on Oct 29, 2003 at 16:11 UTC | |
by alincoln (Acolyte) on Oct 29, 2003 at 16:31 UTC | |
|
Re: Adding elements to hashes of arrays...
by Abigail-II (Bishop) on Oct 29, 2003 at 16:10 UTC |