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?

Answers were Sorted based on User's Feedback



What is a hash? ..

Answer / bhavani

Hash is an associative array where data is stored in
"key"->"value" pairs.

Eg : fruits is a hash having their names and price
%fruits = ("Apple", "60", "Banana", "20", "Peers", "40");

Is This Answer Correct ?    8 Yes 1 No

What is a hash? ..

Answer / 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

What is a hash? ..

Answer / 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

What is a hash? ..

Answer / sam

Hash is a specific datatype in PERL and it contains KEYS
and VALUES. Values are referred with the help of keys.

Is This Answer Correct ?    3 Yes 1 No

What is a hash? ..

Answer / savitha sridhar

Hash or "Associative Array" is an unordered list of scalar
data. The data of the hash is depicted as key and a value
pair.

Eg: %h=("kar","blr","ap","hyd","tn","che");

To print the entire hash : print %h; --returns entire hash
(the order may be different)
To print only one value : print $h{"kar"}; -->returns blr

Is This Answer Correct ?    3 Yes 1 No

What is a hash? ..

Answer / shah faisal

Hash is an unordered pair of keys and values where keys
must be unique else the second duplicate keys replace the
value of first key. Hash is denoted by a "%" sign.
e.g.
"key1"->"value1","key2"->"value2",key1"=>"value3" then
final hash will be %hash=("key2"-
>"value2","key1"=>"value3");

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More CGI Perl Interview Questions

Comment on array slicing and range operator

0 Answers  


Define operators used in perl?

0 Answers  


write a script to display mirror image of a entered value and also check whether Palindrome

3 Answers   HCL, Persistent,


How can we create perl programs in unix, windows nt, macintosh and os/2 ?

0 Answers  


How to dereference a reference?

0 Answers  


How do I replace every TAB character in a file with a comma?

0 Answers  


What does redo statement do in perl?

0 Answers  


Difference between the variables in which chomp function work ?

0 Answers  


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

0 Answers  


How to deleting an existing file in perl programming?

0 Answers  


How the interpreter is used in Perl?

0 Answers  


What are the advantages of programming in perl?

0 Answers  


Categories