Key values would not necessarily be unique but you could search the hash for
keys who have values equal to "1":
foreach (keys %week) {
if ($week{$_} == 1) {
print "$_\n";
}
}
You were probably looking for something like $key = $week{$key} but given
that values are not necessarily uniqye that would cause problems in a data
structure of key/value pairs.
Hope this helps.
Kind regards,
Trevor J. Joerges
--------------------------------------------
$_=q;rrUSFWPSZK.ZKPFSHFT,rkvtuZbopuifsZQZibdl
rrqpxfsfeZcyZQ,,riuuq://xxx.%.dpn,ru~@%.dpn ,rrr8-)
;;s;\~;kpfshft;g;s;\%;tfoenjnf;g;y;B-x;A-w;;
s;P;perl;g;s;,;\n;g;s;Y; ;g;s;q;\t;g;print;
--------------------------------------------
----- Original Message -----
From: "Marcos Lorenzo de Santiago" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 12, 2002 6:59 AM
Subject: can I get the keys from a hash giving the value?
: I got a hash:
:
: %week=("monday" => 1,
: "tuesday" => 2,
: "wednesday" => 3,
: "thursday" => 4,
: "friday" => 5,
: "saturday" => 6,
: "sunday" => 7
: );
:
: and I have $day=1, can I get then "monday"??
:
: thx.
:
: m4c.
:
: _______________________________________________
: Perl-Win32-Admin mailing list
: [EMAIL PROTECTED]
: To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
:
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs