Questions about this topic? Sign up to ask in the talk tab.

Perl/Basics/Hashes/Helper Functions/Each

From NetSec
Revision as of 00:38, 19 July 2012 by Chantal21I (Talk | contribs) (moved Perl/Basics/Hashes/Each to Perl/Basics/Hashes/Helper Functions/Each)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

"while my each" can be used to isolate $key => $value pairs from a hash as follows with our %user hash:

<syntaxhighlight lang="perl">while(my($key,$value) = each(%user)) { print "Key: $key, Value: $value\n"; };</syntaxhighlight>