in reply to add element to hash
Hello sandorado,
...it did not work as expected isn’t a very helpful error description. The following is a guess at what you are trying to do:
#! perl use strict; use warnings; use Data::Dump; my @array1 = qw( a e i o u ); my @array2 = qw( x y z ); my %hash = ( key1 => [ \@array1, \@array2, ], ); dd \%hash; push @{ $hash{key1} }, 'abc'; dd \%hash;
Output:
17:39 >perl 994_SoPW.pl { key1 => [["a", "e", "i", "o", "u"], ["x", "y", "z"]] } { key1 => [["a", "e", "i", "o", "u"], ["x", "y", "z"], "abc"] } 17:39 >
If I’ve guessed wrong, you will need to clarify your question.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: add element to hash
by Anonymous Monk on Sep 01, 2014 at 08:01 UTC | |
by roboticus (Chancellor) on Sep 01, 2014 at 11:28 UTC | |
by NetWallah (Canon) on Sep 01, 2014 at 14:31 UTC |