in reply to array of hashes question

Try accessing like this
foreach my $hash (@a){ foreach my $key (keys %{$hash}){ print "key >$key< value>",$hash->{$key},"<\n"; } }
use 'Data::Dumper' module to print your data structure @a, you can visualize what you have created.
try using
use strict; use warnings; use diagnostics;

show the code of routine 'create_hash_for_filename'
UPDATE
$a[$j]{$key} and $a[$j]->{$key} both will work
you are using @a for merging, but finally expecting output in @octopus_plid, how it is possible?.

UPDATE
nothing wrong in using like
for my $key (keys %{$a[0]}) according to your above presented logic
before calling the second for loop just try use Data::Dumper; print Dumper \@a;

run your script under perl -d
debugger will help you definitely. see 'man perldebug' for usage of debugger

Vivek
-- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.

Replies are listed 'Best First'.
Re^2: array of hashes question
by jimmy78 (Initiate) on Feb 18, 2009 at 17:11 UTC
    Is there anything wrong with this for loop for accessing %{$a[0]}: for my $key (keys %{$a[0]}) { I think this is the issue. I see it does not even go in this loop if i use this.
Re^2: array of hashes question
by Anonymous Monk on Feb 18, 2009 at 19:30 UTC
    Thanks a lot Vivek for your help.. It is worknig now.. There was no issue with this code.. It was another logical mistake !!
Re^2: array of hashes question
by jimmy78 (Initiate) on Feb 18, 2009 at 16:37 UTC
    added code for subroutine
Re^2: array of hashes question
by jimmy78 (Initiate) on Feb 18, 2009 at 16:54 UTC
    it was a typo...nowcorrected it @a only :-> The way you asked to used hash ref for accessing. Is there a way to access just hash ref to first hash in the array ?
Re^2: array of hashes question
by jimmy78 (Initiate) on Feb 18, 2009 at 17:06 UTC
    thks for helping me with this But then what is the issue with xsecond loop ? it does not seem to produce any output and i don't get merged hashes there..