in reply to Re: Re: Getting data out of __DATA__ and __END__
in thread Getting data out of __DATA__ and __END__
solution. Ugh, Zog say map gooood.my @words = map { split " ",$_ } <DATA>;
I also subscribe to the unsubstantiated opinion that a statement like
is exactly like
which would kinda explain this behavior.
again, I would love to be corrected on this and shown the errors of my ways.
I'm a sinner! Ira punnishes his wicked flesh bad, bad flesh. After running some code samples I have no answers but only questions.
So clearly the my declaration of array is *not* local to some implicit scope because use strict doesn't complain when you access it later in the file. And so I used the Dump procedure from Devel::Peek and the plot thickened...
Gave me...use strict; use warnings; use Devel::Peek; my @array = split (" ", $_) while (<DATA>); print Dump(\@array); __DATA__ ksg gae agdg ekau eg Gke geo g ep ge
Note that MAX is 4? When I do this on an empty, never accessed array MAX is -1. So I think that somewhere along the way @array got 4 elements assigned to it. But that's also weird because there should have been 5.SV = RV(0x1a97584) at 0x1a7f0bc REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x1a72ffc SV = PVAV(0x1a7dd3c) at 0x1a72ffc REFCNT = 2 FLAGS = (PADBUSY,PADMY) IV = 0 NV = 0 ARRAY = 0x1a7012c FILL = -1 MAX = 4 ARYLEN = 0x0 FLAGS = (REAL)
Any hubris I had is now confussion. All is lost... all is lost...
Ira.
|
|---|