On Fri, 15 Sep 2006 01:03:18 +0200, Georg Moritz wrote:
> The error is thrown at the moment the <> oprator tries to assign to $_,
> which is an alias to a constant - the '1'.
> 
> Common pitfall ;-)

I know it's a pitfall, I put it in a chapter called "Perl Pitfalls" in my
first book :-)  It's just not common enough for me to remember it all the
time.

> The <> operator does no further aliasing, it operates upon $_ at its
> "current aliasing level".

Which makes me wonder why.  The documentation is clear that <> doesn't
localize $_.  Why not?  Just so that if someone wanted to get at the last
value after the loop they could do it without an extra variable?

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/

Reply via email to