danielcid has asked for the wisdom of the Perl Monks concerning the following question:
It prints:#!/usr/bin/perl use strict; use warnings; use constant CONST1=>10; use constant CONST2=>12; my %var=( CONST1=>'test1', CONST2=>'test2', ); print $var{CONST1}."\n"; print $var{10}."\n";
Isn't that supposed to print "test1" in the second print ?bash-2.05b$ perl test.pl test1 Use of uninitialized value in concatenation (.) or string at test.pl l +ine 13.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Question related to the use of constants
by Aristotle (Chancellor) on Aug 20, 2004 at 17:43 UTC | |
by ikegami (Patriarch) on Aug 20, 2004 at 17:56 UTC | |
|
Re: Question related to the use of constants
by hardburn (Abbot) on Aug 20, 2004 at 17:53 UTC | |
by BUU (Prior) on Aug 21, 2004 at 04:52 UTC | |
|
Re: Question related to the use of constants
by haoess (Curate) on Aug 20, 2004 at 17:44 UTC | |
|
Re: Question related to the use of constants
by ysth (Canon) on Aug 20, 2004 at 18:09 UTC | |
|
Re: Question related to the use of constants
by Prior Nacre V (Hermit) on Aug 20, 2004 at 22:16 UTC | |
|
Re: Question related to the use of constants
by danielcid (Scribe) on Aug 20, 2004 at 19:05 UTC |