values

A

asit

$player = "Sharapova";

%player_country = (
Venus => "USA",
Sharapova => "Russia",
Serena => "USA",
);
print "$player represents : ";
print $player_country{"$player"};
print "\n";

@players = keys %player_country;
@values = values %player_country;

print "@players[0..$#players]\n";
print "@values[0..$#values]\n";

in the above program @values array holds all the values in the hash.
again values is a keyword used to retrieve values from hashes. how the
perl interpreter handles it ???
 
J

Jürgen Exner

asit said:
in the above program @values array holds all the values in the hash.
again values is a keyword used to retrieve values from hashes. how the
perl interpreter handles it ???

Trivial: different name spaces.
%values, @values, $values, values() can easily separeted by the sigil
resp. where/how they are used in an expression.

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top