Hena has asked for the wisdom of the Perl Monks concerning the following question:
The array works as I expected. The hash does not. Is it better to use scalar even though it is not constant (used to do these that way)?> perl -we 'use constant K => 0;$array[0]="value";print $array[K],"\n" +;' value > perl -we 'use constant K => KEY;$hash{"KEY"}="value";print $hash{K}, +"\n";' Use of uninitialized value in print at -e line 1.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using constants
by ikegami (Patriarch) on Oct 13, 2005 at 05:51 UTC | |
by Hena (Friar) on Oct 13, 2005 at 05:57 UTC | |
by ikegami (Patriarch) on Oct 13, 2005 at 06:05 UTC |