Loading ...
Sorry, an error occurred while loading the content.

Lost in a Hash

Expand Messages
  • Oscar Moya
    Hi all, I am trying to learn how to use hashes but I am a little bit lost: If I create a hash like: %Hash = (1,2,1,3,1,4,1,5); And try to obtain its keys and
    Message 1 of 1 , Apr 5 4:56 AM
    View Source
    • 0 Attachment
      Hi all,



      I am trying to learn how to use hashes but I am a little bit lost:



      If I create a hash like:



      %Hash = (1,2,1,3,1,4,1,5);



      And try to obtain its keys and valujes separately:



      @keys = keys %Hash;

      @values = values %Hash;



      print "@keys\n"

      print "@values\n";



      the result is:



      1

      5



      However, if the hash is:



      my %lista = (6,2,7,3,8,4,9,5);



      I get:



      8 6 7 9

      4 2 3 5



      why? repeated values are not accepted? what can I do to get them accepted?



      Thanks in advance



      Óscar







      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.