Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Hash of Arrays

by BillKSmith (Prior)
on Dec 26, 2020 at 00:00 UTC ( #11125741=note: print w/replies, xml ) Need Help??


in reply to Hash of Arrays

If you must use HOA, I prefer to refer to the index with a Readonly variable rather than with a constant because it can interpelate into a string.
use strict; use warnings; use Readonly; Readonly::Scalar my $COLOR => 1; my %hash = ( ef56 => [], ); push @{ $hash{"ef56"} }, 2.6, "red", 4; print "The color of Item ef56 is $hash{'ef56'}[$COLOR]\n";
Bill

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11125741]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2021-04-17 05:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?