You could probably do something like sub checkanything { my $var2 = shift; foreach (keys %HoH) { return $HoH{$_}{$var2} if $HoH{$_}{$var2}; } }
Then in your main body of code, just say something like if ($var1 eq "anything") { $return = &checkanything($var2); } I think that should do it - good luck =) ==================== Brian Arnold [EMAIL PROTECTED] -----Original Message----- From: F.H [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 11:59 AM To: [EMAIL PROTECTED] Subject: hash access issue Hi there, Here is my dilema: %HoH = ( flintstones => { lead1 => "fred", pal1 => "barney", }, jetsons => { lead2 => "george", wife2 => "jane", "his boy"3 => "elroy", }, simpsons => { lead3 => "homer", wife3 => "marge", kid3 => "bart", }, ); $HoH{$key1}{$key2} is the basic structure of my hash. while I am reading from another file that provides 3 variables if $var1 eq flintsones and $var2 eq pal1, then: $HoH{$var1}{$var2} = "barney". Is ther a way that if $var1 eq "anything" and $var2 eq pal1 I can still get "barney". Any help is highly appreciated I.S __________________________________________________________________ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]