Perl: Bon Voyage Lists and Hashes - Making Hashes Out of Lists (
Page 4 of 4 )
You can create hashes that contain list values pretty easily in Perl. This allows you to find list items using a key, as showcased in earlier tutorials. Here we will store some list values in our hash %Hawtie:
#!/usr/bin/perl
%Hawtie =(
'10' => ['Angelina Jolie', 'Actress', 'My Baby Mama'],
'1' => ['Valerie Bertonelli', 'Professional Boxer', 'I would have to
be pretty drunk']
);
$Hawt = $Hawtie{'10'}[0];
print $Hawt . "\n\n";
$Not = $Hawtie{'1'}[0];
print $Not;
Above we created the hash %Hawtie and stored two list values in it, the first containing our “10,” Angelina Jolie and the second containing our “1,” Valerie BertandErnie. We then stored each value in a hot ($Hawt) variable or a not ($Not) variable and printed each out.
Here is what we got:

Conclusion
Well that is all the time we have left for this article, and for the time being, it wraps up our discussion of lists and hashes. In our next series we will be looking more in-depth at Conditionals and Loops and learning to use them in a more advanced way.
Till then...