Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Hash Problem!

by NetWallah (Abbot)
on Sep 30, 2008 at 00:56 UTC ( #714447=note: print w/replies, xml ) Need Help??


in reply to Hash Problem!

No - this is not a HOH - it is a HOAOH.

Try:

# Assuming your outside hash is named %h, print $h{main_data}[1]{AMOUNT} . "\n";
Update: A somewhat more advanced approach: (Assuming %h is the outside hash)
for (map {@$_} values %h){ print "Account " . $_->{ACCOUNT} . " AMOUNT: " if exists $_->{ACCOUN +T}; next unless exists $_->{AMOUNT}; print $_->{AMOUNT} . "\n"; } # --- Output --- # Account 6510334 AMOUNT: 200.00 # Account 6510334 AMOUNT: 0.00

     Have you been high today? I see the nuns are gay! My brother yelled to me...I love you inside Ed - Benny Lava, by Buffalax

Replies are listed 'Best First'.
Re^2: Hash Problem!
by cLive ;-) (Prior) on Sep 30, 2008 at 02:10 UTC
    AOH not HOAOH
      If you are talking about the content inside the [..], then I'd agree that it contains an AOH.

      From my perspective, the outermost
      'main_data' => [...
      indicates that it is either a hash or hashref. Of course, the programmer could be misusing the "=>" instead of a comma, making the outermost element an array, but that is marginally perverse.

      So. in the absence of information to the contrary, I'll stick with my interpretation of HOAOH.

           Have you been high today? I see the nuns are gay! My brother yelled to me...I love you inside Ed - Benny Lava, by Buffalax

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://714447]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2017-09-24 03:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (273 votes). Check out past polls.

    Notices?