Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Aug 212010

A simple hash in Perl


Hash is a dictionary like data structure in Perl. It allows you to direct access to a particular element inside a hash.


use strict;
use warnings;

my %hash = (
        "a" => "1",
        "b" => "2",

print $hash{"b"}; # print "2"

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>