Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array of Hash of Array (AoHoA)

Status
Not open for further replies.

CJason

Programmer
Oct 13, 2004
223
US
I posted something earlier (HoAoA), but what I actually need (upon further research), is AoHoA...so, I decided to repost! This is what I got so far:

Code:
$hash{THIS} = [@array];
$AoHoA[0] = %hash;

Is this correct? If so, the next question I have is...how would I POP an element from @array?

Thanks!
 
Perl:
pop @{$hash{'THIS'}};
untested...

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Steve, I haven't tested your idea either...but, isn't that how to pop from a hash of arrays? I have the added complexity of an ARRAY of a hash or arrays.
 
Steve, your suggestion in the other post to use:
Code:
use Data::Dumper;
print Dumper(%myReallyComplicatedStructure);
to help debug, was VERY useful. Here's my solution to this problem:
Code:
$hash{THIS} = [@array];
$AoHoA[0] = \%hash;
pop(@{$AoHoA[0]{THIS}});

Thanks...yet again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top