Perl
  Home arrow Perl arrow Perl Hashes
Dev Shed Forums 
Administration  
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 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
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 Hashes
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-04-28

    Table of Contents:
  • Perl Hashes
  • Creating A Hash
  • Printing from a Hash
  • Printing All the Values or Keys in a Hash
  • Alternative Methods for Creating Hashes

  • 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

    PCmover - $15 Off with Coupon Code CJPH7Q

    Perl Hashes
    (Page 1 of 5 )

    Thanks for stopping by for this seventh part in the series on Perl Lists and Hashes. Here we will discuss working with a new way to store data known as a Hash. We'll cover the basics, such as how to create them, and how to locate data within them. You'll learn to add records, remove records, and much more. If there is time, we will also cover multidimensional lists.

    In our previous article we covered the remaining List::Util subroutines. We used min(list) to find the minimum numeric value in a list. We also worked with its brother, the minstr(list), which as you will recall found the smallest string value in a list. We learned that uppercase letters hold a lower value, surprisingly, then lowercase ones. We also learned to use shuffle to randomly sort our lists, and sum(list) to sum up the numeric values in our lists.

    Hash...Not What It Sounds Like

    If you have worked with Access or Excel, or any grid-type program, you are familiar with the concept of a hash. These aren't exactly like a hash mind you, but a similar idea. Whereas with a typical list, you refer to the values stored in them by referencing their element or index number, like so:

      array[0]

    with hashes you look them up with their key. When you create an element in a hash, you assign it a key value. That key, plus the value, creates a record. If that is still confusing to you, never fear: after our example it should be crystal clear.

    More Perl Articles
    More By James Payne


       · Just a small correction, at the beginning where it says "... uppercase letters hold...
       · Hey,Thanks for catching that Pedro. Glad you enjoyed the article.
       · Thanks for stopping by to read another article in my series on Perl Lists and...
     

       

    PERL ARTICLES

    - Perl: A Continuing Look at Hashes and Multid...
    - Perl: Another Round with Hashes
    - Perl Hashes
    - Perl Lists: A Final Look at List::Util
    - Perl Lists: Utilizing List::Util
    - Perl Lists: The Split() Function
    - SQL and CGI with Perl and DBI
    - Perl Lists: More Functions and Operators
    - SELECT Queries and Perl
    - Perl Lists: More on Manipulation
    - Creating a Database with Perl and DBI
    - Perl: Sailing the List(less) Seas
    - Perl and DBI
    - Perl: Concatenating Text and More
    - Perl Text: Quoting Without Quote Marks

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway