Perl hashrefs and 'each' function

by David Mintz <mambomintz(at)>

 Date:  Thu, 24 Feb 2000 10:58:33 -0800 (PST)
 To:  hwg-languages(at)
  todo: View Thread, Original
Hey everybody.

I was wondering if/how you can use the 'each' function
with a hash reference instead of a hash, i.e., how
doing you do this:

    while ( ($key, $value) = each(%hash) ) {

      print "The value of $key is $value\n"

with a $hashref rather than %hash.

You get an error when you try to use $hashref as an
argument to each because Perl wants a hash.

     David Mintz
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA