mfort has asked for the wisdom of the Perl Monks concerning the following question:
Output:#!/usr/bin/perl print "test=$test\n"; print "this won't be printed\n" if (scalar @{$test}[0]); print "test=$test\n";
In a larger script, $test will either be undef or will be a reference to an array of data, where the first element is an array reference. I would have expected 'scalar' to examine only, not create an anonymous array. So what is the logic employed by perl?test= test=ARRAY(0x7fcc8c004ee8)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why will referencing an undefined value as array reference create a real array
by jeffa (Bishop) on Jun 18, 2014 at 18:54 UTC | |
by mfort (Novice) on Jul 28, 2014 at 15:46 UTC | |
|
Re: Why will referencing an undefined value as array reference create a real array
by Anonymous Monk on Jun 18, 2014 at 18:57 UTC | |
|
Re: Why will referencing an undefined value as array reference create a real array
by LanX (Saint) on Jun 19, 2014 at 02:55 UTC | |
|
Re: Why will referencing an undefined value as array reference create a real array
by ikegami (Patriarch) on Jul 29, 2014 at 14:43 UTC | |
|
Re: Why will referencing an undefined value as array reference create a real array
by locked_user sundialsvc4 (Abbot) on Jun 19, 2014 at 13:44 UTC |