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
How to check the status of airplane mode (enable/disable) in perl for Android mobile?
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 ?
We all know private variables exist in perl. But do private METHODS exist in perl ? Eg ?
Explain perl.
“The methods defined in the parent class will always override the methods defined in the base class”. What does this statement means?
You want to connect to sql server through perl. How would you do that?
Mention what is cpan?
How do you set environment variables in perl?
What do you mean by context of a subroutine?
What is v-strings?
What is the purpose of goto expr statement?
What is the use of now constructor in perl?
How to create a package?
What is the peculiarity of returning values by subroutines in perl?
What is boolean context?