deepakg has asked for the wisdom of the Perl Monks concerning the following question:
Now exists $dow[5] returns false. I expected exists($dow[5]) to be true and defined($dow[5]) to be false. Also dumping the array (Dumper(\@dow)) shows [undef, undef, undef, undef, undef, "Sat"]. If I do $dow[5] = undef; and then do exists($dow[5]) returns true. How does exists work for arrays - do I have to explicitly initialize an element before it "sees" it? I am on perl 5.10.0 on Snow Leopard. Thanks, Deepak@dow = (); $dow[6] = "Sat";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Exists and arrays
by AnomalousMonk (Archbishop) on Oct 01, 2009 at 10:01 UTC | |
|
Re: Exists and arrays
by ccn (Vicar) on Oct 01, 2009 at 10:04 UTC | |
|
Re: Exists and arrays
by johngg (Canon) on Oct 01, 2009 at 13:29 UTC | |
|
Re: Exists and arrays
by ikegami (Patriarch) on Oct 01, 2009 at 15:26 UTC | |
|
Re: Exists and arrays
by biohisham (Priest) on Oct 01, 2009 at 11:38 UTC | |
|
Re: Exists and arrays (Dumper)
by toolic (Bishop) on Oct 01, 2009 at 13:19 UTC | |
|
Re: Exists and arrays
by deepakg (Novice) on Oct 03, 2009 at 18:47 UTC | |
by JadeNB (Chaplain) on Oct 03, 2009 at 21:18 UTC |