Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is a hash?

Answer Posted / prabhath kota

As friends said above, its otherwise called as associative
array. It has lot of advantages over perl.

Here we can keep the values in a structured way, that
structured way comes from key-value pairs.

Eg: (The syntax given above are also correct, but the below
representation is much better in look and feel)

my %hash_example = ( a => 10,
b => 20,
c => 30 );
keys : a,b,c
values : 10,20,30

Features of Hash :
##################
1) Keys should always be unique where as values may not be
unique

(Right)
my %hash_example = ( a => 10,
b => 10,
c => 10 );

(wrong)
my %hash_example = ( a => 10,
a => 20,
a => 30 );

2) keys (%hash_example) will return an array containing only
keys

my @keys = keys(%hash);

3) similary for values
my @values = keys(%values);

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write syntax to add two arrays together in perl?

928


What is confess function in perl?

940


Explain use of ‘my’ keyword in perl?

937


Demonstrate subroutines in perl with a simple example.

859


How to compare two strings in perl?

946


What is the use of '>>' in perl?

1017


what are steps to do to lock the sony ericsson mobile with password?

2205


What does `new $cur->{LINK}' do? (Assume the current package has no new() function of its own.)

944


What value is returned by a lone `return;’ statement?

1061


What is chomp() operator/function?

1064


What is boolean context?

1000


Why to use perl?

953


Explain the meaning of subroutine?

976


How to read multi lines from a file in perl?

923


Differences between die and exit.

1000