>>>>> "JG" == Joel Gwynn <[EMAIL PROTECTED]> writes:
JG> my @test = qw(granny_smith crabapple);
JG> foreach my $t (@test){ print "$t not found\n" unless $apples{$t}{weight}
JG> } print "\n-----------------------\n"; foreach my $a (keys %apples){
JG> print "$a: weight: $apples{$a}{weight}\n";
JG> }
JG> Now, what's driving me crazy is that the two test values are being added
JG> to the hash, simply by looking for $apples{$t}{weight}. If I simply
JG> look for $apples{$t}, like so:
JG> foreach my $t (@test){ print "$t not found\n" unless $apples{$t} }
JG> new hash members are not created. Why should this be?
the cause is autovivification.
read these articles (first is by me, second by randal schwartz):
http://tlc.perlarchive.com/articles/perl/ug0002.shtml
http://www.stonehenge.com/merlyn/UnixReview/col44.html
uri
--
Uri Guttman ------ [EMAIL PROTECTED] -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm