Perl: What are hash variables and what is their importance?

Bharath • 5 days ago

pls let me know what is hash variables? hw is it different from the normal variables? hw is it useful? And it’s importance.
Thanks

A hash is a collective data type, it was also known as an associative array, and the difference between an array and a hash is that one can access hash elements by name, so every member has an associated name. Hence the name associative. The usefulness stems from the fact that, when one has to deal with bigger data collections, it’s easier to find the data you need using hashes. Hashed are prefixed by the procent sign, like so:
my %hash = (); //we initialized an empty hash
Here’s how to input some data:
%hash = (
key1 => ‘value1’,
key2 => ‘value2’,
key3 => ‘value3’,
);