The hash you listed has one key comprised to the values of two variables. I believe you meant to use

$hash{$key1}{$key2} = $data;
...
forash $key1 (sort keys %hash)
{  foreach $key2 (sort keys %{$hash{$key1}})
   {  print "key1 = $key1\tkey2 = $key2\n";
   }
}

Don


Allison, Jason (JALLISON) wrote:
Sorry for the horribly lame question, but I am not having any luck finding an answer, probably because I don’t know how to phrase the question properly.

When I have a hash defined by multiple keys, how can I pull both keys out?

$hash{$key1, $key2} = $data;
...
foreach $key (sort(keys(%hash))) {
  # here ??
  my ($key1, $key2) = split(/ /, $key, 2);
}

Thanks a bunch,
Jason


------------------------------------------------------------------------

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to