Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Different hashes?

by Fletch (Bishop)
on Mar 26, 2004 at 14:58 UTC ( [id://340030]=note: print w/replies, xml ) Need Help??


in reply to Different hashes?

You're clearing out the entire hash each time through the loop and replacing it with new contents. You want push @{ $AllProducts{ $Category } }, [ $ID, [ $Name, $Type, $Size ] ]. See perldoc perlreftut, perldoc perldsc, and perldoc perllol.

Replies are listed 'Best First'.
Re: Re: Different hashes?
by Happy-the-monk (Canon) on Mar 26, 2004 at 15:12 UTC

    Fletch and borisz:
    the outer array referencing brackets [ ] are still wrong, take them away and you got it right.

      Actually what he probably really wants is a HOH and should be doing something like:

      $AllProducts{ $Category }->{ $ID } = { name => $Name, type => $Type, s +ize => $Size };

      But that's why he should read perldoc perldsc.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://340030]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-20 00:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found