Perl hashrefs and 'each' function
by David Mintz <mambomintz(at)yahoo.com>
|
Date: |
Thu, 24 Feb 2000 10:58:33 -0800 (PST) |
To: |
hwg-languages(at)hwg.org |
|
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
http://www.panix.com/~dmintz
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA