in reply to Re: hash, a troublemaker?
in thread hash, a troublemaker?
You seem to be reinventing fields, and, dare I say it, pseudo-hashes, a now deprecated feature where you could (or still can) use the hash syntax to access fields in an array.
Borrowing your example, the internal structure for pseudo-hashes is:
And you can access it like:my $record = [ { K_AGE => 1, K_NAME => 2 }, 1001, 'Doraemon' ];
It just works for 5.6.x, still works for 5.8.3 though with a warning, and this feature will be gone from 5.10.0 on. See the docs on fields for more info, including info on what you really should be using instead.print "Name: '$record->{K_NAME}' Age: $record->{K_AGE}\n";
|
---|
In Section
Seekers of Perl Wisdom