develooper Front page | perl.perl5.porters | Postings from January 2012

[perl #33095] Misleading documentation for "while (<>)"

Thread Next
From:
James E Keenan via RT
Date:
January 31, 2012 18:14
Subject:
[perl #33095] Misleading documentation for "while (<>)"
Message ID:
rt-3.6.HEAD-14510-1328062486-1170.33095-15-0@perl.org
On Fri Dec 17 17:57:00 2004, kj789@lycos.com wrote:
> This is a bug report for perl from kj789@lycos.com,
> generated with the help of perlbug 1.34 running under perl v5.8.0.
> 
> [snip]
> 
> Also, "magical" is not defined, and there is no way for a user to
> determine how to find out what this means.  In light of the first
> bug, the natural conclusion is that the unexpected behavior of
> "last" has something to do with ARGV's "magical" properties, but
> there's no way for the user to confirm or refute this guess.
> 

Discussion in this ticket petered out seven years ago.  However, I think
the OP made, in passing, a valid point:  the meaning of "magic" or
"magical" is nowhere defined in 'perlop':

#####
$ grep -inC1 magic pod/perlop.pod
162-
163:The auto-increment operator has a little extra builtin magic to it.  If
164-you increment a variable that is numeric, or that has ever been used in
--
179-
180:The auto-decrement operator is not magical.
181-
--
897-
898:The range operator also works on strings, using the magical
899-auto-increment, see below.
--
988-
989:The range operator (in list context) makes use of the magical
990-auto-increment algorithm if the operands are strings.  You
--
1005-
1006:If the final value specified is not in the sequence that the magical
1007-increment would produce, the sequence goes until the next value would
--
1009-
1010:If the initial value specified isn't part of a magical increment
1011-sequence (that is, a non-empty string matching
C</^[a-zA-Z]*[0-9]*\z/>),
--
1595-corresponding C</STRING/msixpodual> expression. The returned value is a
1596:normalized version of the original pattern. It magically differs from
1597-a string containing the same characters: C<ref(qr/x/)> returns
"Regexp";
--
2897-internally. <> is just a synonym for <ARGV>, which
2898:is magical.  (The pseudo code above doesn't work because it treats
2899:<ARGV> as non-magical.)
2900-
#####

How should this be rectified?

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=33095

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About