On Thu, Feb 06, 2003 at 10:56:06AM -0500, Joel Gwynn wrote:
> my %apples = (macintosh => {weight => '10lb', cost => '5'},
> red_delicious => {weight => '15lb', cost => '2'},
> fuji => {weight => '12lb', cost => '7'});
>
> my @test = qw(granny_smith crabapple);
>
> foreach my $t (@test){ print "$t not found\n" unless $apples{$t}{weight}
> } print "\n-----------------------\n"; foreach my $a (keys %apples){
> print "$a: weight: $apples{$a}{weight}\n";
> }
aren't you auto-vivifying the hash keys, are you're looking them up? by
checking the value of $apples{crabapple}{weight} you are automatically
creating those keys. perhaps 'exists' would avoid that? or you could
check the existance of $apples{rabapple} before checking any subkeys on
it.
HTH!
Dan
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm