[Chicago-talk] Multi dimensional hash
richard at rushlogistics.com
richard at rushlogistics.com
Sun Oct 11 13:07:20 PDT 2015
If I have the following hash reference:
my $input_hash = {
Hometown => 'Chicago',
FName => 'Jim',
LName => 'Brown',
Nickname => 'Jimbo',
};
Is there a way that I can create a multimensional hash like they've done here http://perlmaven.com/multi-dimensional-hashes
But instead have it structured with the input_hash's key name as one of the dimensions? So that I would have:
$validtn_hash{class}{input_hash_key} = input_hash value; # where City and Name are examples of classes
$validtn_hash{"City"}{Hometown} = $input_hash->{Hometown};
$validtn_hash{"Name"}{FName} = $input_hash->{FName};
$validtn_hash{"Name"}{LName} = $input_hash->{LName};
$validtn_hash{"Name"}{Nickname} = $input_hash->{Nickname};
Or is this even possible?
Thanks
More information about the Chicago-talk
mailing list