RE: it's probably just me
"JONES, ROBERT E CTR USAF AETC AETC/A5TP" <[email protected]> Wed, 28 Oct 2015 15:20:12 +0000
| Newsgroups | gmane.comp.lang.perl.active-perl |
|---|---|
| Message-ID | <77E954C31CCD8F449CC9A2B79F6228486FA5ED95@52VEJX-D05-02A.area52.afnoapps.usaf.mil> |
If you're creating an array you should use parenthesis ().
Robert Jones, BSP, BSCS
TTMS Project Interfaces
Keesler AFB
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of John DePasquale
Sent: Wednesday, October 28, 2015 10:13 AM
To: [email protected]
Subject: it's probably just me
Hi perl mavens,
I'm sure I just don't understand something here, but this one makes zero sense to me:
The following snippet prints a 1
local @aList;
push @aList, ['first','second','third'];
my $nCount = @aList;
print "count: $nCount";
BUT, if I add one seemingly irrelevant line ( the second one below ), something crazy happens:
local @aList;
print "non-existent value: $aList[0][0]\n";
push @aList, ['first','second','third'];
my $nCount = @aList;
print "count: $nCount";
instead of printing a 1, the last line prints a 2
So the reference in the first print statement to $aList[0][0] appears to have the affect of creating a row in the array.
Is this supposed to work this way? Why would such a reference to a non-existent array row result in the creation of an array row?
Thank you.
- john
John DePasquale
Chief Executive Officer
Paradigm Consulting
"Proudly presenting the Vinopedia System"
www.vinopedia.us <http://www.vinopedia.us/>
49 Dalby Street
Newton, MA 02458
Mobile: 617-610-2424
Fax: 617-600-7326
________________________________
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs