What is a hash?

Answer Posted / raghav

Hash/Associative array is the one in which all
the values are stored in terms of keys and values.

i.e., the values are indexed with the help of keys.
You cannot get back the values in a correct order as it
happens in normal array. because in this values are stored
in random positions. The only way to get in a correct order
is to sort that array.

ex: %hash = {"Name","Raghav","Age","26"};
$hash{'Name'} will give "Raghav"
$hash{'Age'} will give "26"

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate use and require?

533


What are perl strings?

516


Differences between die and exit.

623


Which feature of perl provides code reusability?

571


Explain lists and ivalue?

561






What does read () command do?

522


How do I print the entire contents of an array with Perl?

534


What is cpan ? What are the modules coming under this?

512


What are the different instances used in cgi overhead?

584


How to disable the mod_perl from apache_server as i have used perlfect search on the site and its pagination is not working and the remedy is to disable the mod_perl.

1801


Define say() function in perl?

544


What are scalars?

555


Which statement has an initialization, condition check and increment expressions in its body? Write a syntax to use that statement.

551


What is Perl?

563


What happens in dereferencing?

541