Perl
  Home arrow Perl arrow Perl: Bon Voyage Lists and Hashes
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PERL

Perl: Bon Voyage Lists and Hashes
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-08-12

    Table of Contents:
  • Perl: Bon Voyage Lists and Hashes
  • Adding and Removing Values
  • Push
  • Making Hashes Out of Lists

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Perl: Bon Voyage Lists and Hashes


    (Page 1 of 4 )

    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.

    In our previous article we created a “database” of a bookshelf with some books on it. We then learned how to add rows to it, add a single column, and automate a process to add columns to every row. Here, we will continue working with the @Bookshelf “database.” Just so you don't have to go seeking out our previous article, here is the list of fields:

    • Book Number

    • Author

    • Title

    • Genre

    • Number of Stars (how good the book was in a ranking of 1-5, with five being the best)

    • Which shelf on the bookshelf it is located

    And the code to create the two-dimensional list:


    #!/usr/bin/perl

    @Bookshelf = (

    [" # ", " Author ", " Title ", " Genre "," Rating "," Location " ],

    [' 1 ', ' Stephen King ', ' It ', ' Horror ', ' 5 ', ' Top '],

    [' 2 ', ' Clive Barker ', ' Imajica ', ' Horror ', ' 5 ', ' Top '],

    [' 3 ', ' Neil Gaiman ', ' American Gods ', ' Dark Fantasy ',' 5 ',

    ' Top '],

    [' 4 ', ' Dean Koontz ', ' Tick-Tock ', ' Horror ', ' 1 ', '

    GarbageCan '],

    [' 5 ', ' Charles Bukowski ', ' Letters from a Dirty Old Man ', '

    Literature ', ' 5 ', ' Top '],

    [' 6 ', ' Chuck Pahluniak ', ' Fight Club ', ' Dark Fantasy ', ' 5 ', ' Middle ']

    );

    More Perl Articles
    More By James Payne


     

       

    PERL ARTICLES

    - More Templating Tools for Perl
    - Site Layout with Perl Templating Tools
    - Build a Perl RSS Aggregator with Templating ...
    - Looping, Security, and Templating Tools
    - Perl: Bon Voyage Lists and Hashes
    - Templating Tools
    - Perl: Number Crunching
    - Perl Debuggers in Detail
    - Debugging Perl
    - Perl: More on Lists and Hashes
    - Perl: Dimensional Lists
    - Perl: A Continuing Look at Hashes and Multid...
    - Perl: Another Round with Hashes
    - Perl Hashes
    - Perl Lists: A Final Look at List::Util

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT