[Chicago-talk] print keys for anon hash

Steven Lembark lembark at wrkhors.com
Mon Dec 15 11:03:26 CST 2003

-- "Dooley, Michael" <Dooley.Michael at con-way.com>

> How do I print out the keys for a specific anon hash?

Given you have the anon hash stored in a scalar somewhere
(otherwise it's gone for good) use "keys %$referent" rather
than "keys %hash". If your referent is buried inside of a
data structure then sourround it with curlies ("{}") to
manage the order of precidence:

	print keys %$hashreferent;

	print keys %{ $hashreferent };

	print keys %{ $hashlist[$offset] };

> if I say print $crew[0]{'name'},"\n"; I can get the name of a specific key
> but what if I wanted all the keys for that anon hash?

	keys %{ $crew[0] }

Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                            +1 888 359 3508

More information about the Chicago-talk mailing list