smackdab has asked for the wisdom of the Perl Monks concerning the following question:
That the exists key word is "creating" the hash...use strict; my $self = {}; my $f1 = "aaa"; my $f2 = "bbb"; my $f3 = "ccc"; my $val = "val"; print "count = ".%$self."\n"; print "found\n" if exists $self->{$f1}{$f2}{$f3}; print "count = ".%$self."\n"; print "it is aaa\n" if exists $self->{$f1}; print "it is bbb\n" if exists $self->{$f1}{$f2}; print "it is ccc\n" if exists $self->{$f1}{$f2}{$f3}; print "count = ".%$self."\n";
Fixed code tags - dvergin 2002-07-03
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: hash surprise
by DamnDirtyApe (Curate) on Jul 04, 2002 at 05:05 UTC | |
by smackdab (Pilgrim) on Jul 04, 2002 at 06:28 UTC | |
|
Re: hash surprise
by Courage (Parson) on Jul 04, 2002 at 05:37 UTC | |
|
Re: hash surprise
by Zaxo (Archbishop) on Jul 04, 2002 at 05:33 UTC |