The manual says that comments begin with a # sign and that everything on the line after the # sign is ignored. Whoops, not quite. Perl doesn't always ignore # signs, as this program demonstrates:
while (<DATA>) {
print;
sleep 1;
}
__DATA__
Who are you?
The new #2.
Who is #1?
You are #6.
I am not a #. I am a free man!
Clearly, Perl is not ignoring everything after the # sign. The following patch (against 5.005_56) fixes this long-standing problem.
--- pod/perldelta.pod.orig Tue Mar 23 04:54:05 1999
+++ pod/perldelta.pod Tue Mar 23 04:55:19 1999
@@ -10,7 +10,11 @@
=head2 Perl Source Incompatibilities
-None known at this time.
+=item New filehandle read semantics
+
+A long-standing but in the filehandle read operation C<E<lt>...E<gt>>
+has been repaired. This may result in certain file reads behaving
+differently than they did before.
=head2 C Source Incompatibilities
--- pp_hot.c.orig Tue Mar 23 02:56:49 1999
+++ pp_hot.c Tue Mar 23 12:02:35 1999
@@ -1335,6 +1335,14 @@
}
RETURN;
}
+ { /* Fix unrecognized comment bug 19990401 MJD */
+ char *pound = NULL;
+ if (pound = strchr(SvPVX(sv), '#')) {
+ strcpy(pound, SvPVX(PL_rs));
+ *(pound + SvCUR(PL_rs)) = '\0';
+ SvCUR(sv) = pound - SvPVX(sv) + SvCUR(PL_rs);
+ }
+ }
/* This should not be marked tainted if the fp is marked clean */
if (!(IoFLAGS(io) & IOf_UNTAINT)) {
TAINT;
The joke didn't come off as well as I'd hoped. Sarathy got it right away, and sent a note to Perlbug calling me a `fool', which gave the whole thing away. (He said afterwards that he wished he had not copied his note to the mailing list.) Before that happened, I did get one reply from someone pointing out the misspelling of `bug' as `but'.
It would have been clever to put the typo in on purpose, as bait, but I'm not clever that way. It was a real typo.
Return to: Universe of Discourse main page | What's new page | Perl Paraphernalia