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

How to check the status of airplane mode (enable/disable) in perl for Android mobile?

3133


How can I implement the function overloading in Perl ? I read about the operator overloading, I do not know how to implement the function overloading. Thanks in advance ?

2964


We all know private variables exist in perl. But do private METHODS exist in perl ? Eg ?

2562


Explain perl.

982


“The methods defined in the parent class will always override the methods defined in the base class”. What does this statement means?

1063


You want to connect to sql server through perl. How would you do that?

990


Mention what is cpan?

1079


How do you set environment variables in perl?

1106


What do you mean by context of a subroutine?

1027


What is v-strings?

1141


What is the purpose of goto expr statement?

960


What is the use of now constructor in perl?

1017


How to create a package?

1002


What is the peculiarity of returning values by subroutines in perl?

960


What is boolean context?

1047