in reply to Re: RFC - FAQ for Modification of a read-only value attempted
in thread RFC - FAQ for Modification of a read-only value attempted

The builtins for, map, grep, sort all operate on lists of references; same with foreach.

If for weren't iterating over a list of references, constructs like for(sort keys %hash) would not work as expected (or as they do ;-)

Consider this thospel code snippet

perl -le '@a=qw(a e f c b d); $_=$i++ for sort @a; print @a' 045213

which prints out the sequence of array indices needed to access the unsorted array elements in sorted order.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
post 300