values

Discussion in 'Perl Misc' started by asit, Oct 3, 2008.

  1. asit

    asit Guest

    $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 ???
     
    asit, Oct 3, 2008
    #1
    1. Advertising

  2. asit <> wrote:
    >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
     
    Jürgen Exner, Oct 3, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jorgen Gustafsson
    Replies:
    4
    Views:
    585
    Jorgen Gustafsson
    Dec 12, 2003
  2. S. Justin Gengo
    Replies:
    2
    Views:
    365
    S. Justin Gengo
    Aug 20, 2003
  3. Richard Dixson
    Replies:
    1
    Views:
    516
    Joe Fallon
    May 18, 2004
  4. Richard Dixson
    Replies:
    2
    Views:
    736
    Richard Dixson
    May 18, 2004
  5. Rob Meade
    Replies:
    2
    Views:
    1,757
    Rob Meade
    Aug 10, 2004
Loading...

Share This Page