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

Perl/Basics/Hashes/Helper Functions/Keys

From NetSec
Revision as of 02:26, 16 July 2012 by AlizaLorenzo (Talk | contribs) (Created page with "This uses a foreach() loop and casting. We can isolate $key=>$value pairs the same as above using keys in stead of each: {{code|text=<syntaxhighlig...")

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

This uses a foreach() loop and casting. We can isolate $key=>$value pairs the same as above using keys in stead of each:

<syntaxhighlight lang="perl">foreach my $key (@{sort keys %user}) { print "Key: $key, Value: ". $user{$key} ."\n"; };</syntaxhighlight>