Thanks for stopping by for our final article on Perl lists and hashes. This marks our twelfth issue on the subject (at least until we get to some more advanced techniques later on) and in it, we will look at a few of the functions for manipulating two-dimensional lists, how to create lists with more than two dimensions, and finally, how to make a hash full of lists, which is really quite a handy tool.
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:
'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.