| Mark Rogaski on 24 Nov 2003 00:11:40 -0500 |
|
An entity claiming to be Walt Mankowski (waltman@pobox.com) wrote:
:
: In nearly every other case I can think of in Perl, array elements work
: just like scalars. You can, for instance, take references to them and
: use local on them. In fact, a reference to an array element says that
: it's a scalar reference.
:
: So what's so special about foreach loops that array elements aren't
: permitted? And if they are explicitly forbidden, where is that
: documented?
:
Walt,
I think the limitation has to do with foreach loop index being an alias,
as opposed to a hard reference. Being an alias, such a syntax would imply
something like:
*c[0] = 0;
Setting up such a glob would blow up when you tried to see what was in
$c[0], because it wouldn't know whether it was a scalar named ${c[0]} or
an array element named @{c[0]}.
Mark
--
[] |
[] Mark Rogaski | Censorship is the tool of those who have the
[] wendigo@pobox.com | need to hide actualities from themselves and others.
[] mrogaski@cpan.org | -- Charles Bukowski
[] |
Attachment:
pgpLO4BneCfFr.pgp
|
|