Hi there!
Hello,
I'm trying to create a hash of array of hashes, which seems to success with the following command:
my %fileresults = { "NULL" => ( "NULL", 0, { "NULL" => ( "<NULL>", 0 ) } ) };
What you have there is a hash with one key and no value. If you had had warnings enabled then perl would have warned you about that.
$ perl -e' use warnings; use Data::Dumper; my %fileresults = { "NULL" => ( "NULL", 0, { "NULL" => ( "<NULL>", 0 ) } ) }; print Dumper \%fileresults; ' Odd number of elements in anonymous hash at -e line 4. Reference found where even-sized list expected at -e line 4. $VAR1 = { 'HASH(0x814e448)' => undef };
It looks like there is some confusion with Perl's data structures:
perldoc perldata perldoc perldsc perldoc perllol perldoc perlref
It looks like what you really want is:
$ perl -e' use Data::Dumper; my %fileresults = ( "NULL" => [ "NULL", 0, { "NULL" => [ "<NULL>", 0 ] } ] ); print Dumper \%fileresults; ' $VAR1 = { 'NULL' => [ 'NULL', 0, { 'NULL' => [ '<NULL>', 0 ] } ] };
However when I want to update the values of hash2 using the command
%fileresults->{$key}->[2]->{$key2} = ($msg,$size);
That should be either:
$fileresults{ $key }[ 2 ]{ $key2 } = [ $msg, $size ];
Or:
@{ $fileresults{ $key }[ 2 ]{ $key2 } } = ( $msg, $size );
John -- use Perl; program fulfillment
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>