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>
|