on 10/11/2000 08:47 PM, Sveinbjorn Thordarson at paladeen@soth.zoneit.com wrote: > I'm working with Net::Hotline, and I need to know how to dereference > hashes. > > $hlc->userlist returns a reference to a hash. How would I go about > printing every element of the hash? > > I have no idea how dereferencing in Perl works, and from what I read in > programming perl, it's very, very silly....and accessing actual values > is hard work. > > I'd really appreciate help on this one. In all serious honesty the BEST way you can help yourself *permanently* on this one is to do exactly what the denizens of comp.lang.perl.misc made me do -- read perlref, perllol, perldsc (under Shuck's "advanced topics" section) *thoroughly*, backwards and forwards.. therein lies ALL the information you need. I had an idea for a multilevel 'hash' structure I needed to keep track of my data with in order to import the varying 'levels' of hierarchy and yet leave it sort-able in its various structures. no one there would explain it to me, telling me that it would be FAR better for me to 'build it in reverse' so that I KNOW how it's built, and then understanding DE-referencing would fall in to place that much easier. They were absolutely correct -- since then, I completely understand how hashes of hashes and lists of lists work, and how to de-reference them properly, and have used them many many times since, without having to ask for help on the data-structures once. I can assure you as one 'reference newbie' to another that once you DO understand the structure, it's EASY. :D *really* easy. my structure was in fact a rather more complex one .. a hash of a hash of an array. heheh .. and this, I learned how to use, about roughly three weeks after delving into perl for the very first time ever. Trust me, you can do it. :)) here's how you 'build one in reverse' (or, how I 'designed' mine, anyway.. (just be aware that you need to remember when to use parenthesis and when to use braces or brackets [this example uses all three])): my %complextable = ( 'Assault' => { 'as-test' => [ 'AS-Test', '500', 'as-test', '5' ], 'as-something' => [ 'AS-SomeThing', '1234', '-1', '-1' ], 'as-newmap' => [ 'AS-NewMap', '786', 'as-newmap', '9.5' ] }, 'CaptureTheFlag' => { 'ctf-test0r' => [ 'CTF-Test0r', '236', 'ctf-test0r', '7.5' ], 'ctf-someotherthing][' => [ 'CTF-SomeOtherThing][', '2867', '-1', '-1' ], 'ctf-othermap]|[' => [ 'CTF-OtherMap]|[', '1436', 'ctf-othermap]|[', '5.5' ] } ); so, when importing to it, I just had to split on the tabs in the input file, and then assign to it thus: %master_maps_list{$gametype}{lc($title)} = [$filename, $title, $size, $review, $rating]; learning how to ----de-reference---- this hash is left as an exercise for the reader, and WILL benefit you by teaching yourself, because then you will KNOW It... and know WHY it's done that way... and forever after will be able to do it on your own.. ...the light of epiphany will dawn on you, and you'll be heard to shout "ohhhhhhhhhh I _GET_ it!" etc etc. :) # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org