Without actually running the program, what do you think the following prints?
print <Update: Thanks to pudge for fixing the bug which made the above code hard to display.
exit
jdavidb on 2008-07-10T18:31:06
Just "exit". Then it defines an unused string that also consists of "exit". Now I'll go see if I'm right.
Re:exit
Ovid on 2008-07-10T21:30:48
Curiously, the output is different on my MacBook (but also wrong).
Re:exit
jdavidb on 2008-07-11T12:44:09
That is indeed strange. My 5.10.0 just printed exit, as I predicted.
:) Cute challenge
jarich on 2008-07-11T01:20:57
I thought it'd print "\nexit\n\n" (because of your extra newlines). It's a cute problem though, certainly made me think for a moment. Better rewritten as:print << END;
exit
END;
<< STRING;
exit
STRING;Re:Cute challenge
Ovid on 2008-07-11T08:16:17
Actually, the extra newlines were an artifact of a bug in use.perl. Pudge has fixed it.
That being said, yesterday I found that my MacBook was giving me a "Can't find string terminator" error but the Solaris box I was working on was printing:
exit
<<print;
exitThis morning, the Solaris box is printing the right thing, but I had to reboot due to a "security upgrade" and now I can't reproduce the error
:( Bug
pudge on 2008-07-11T03:26:08
<<print;
exit
<<print;
exitThanks Ovid, looks like I found the bug and fixed it. Feel free to amend your journal entry.
Re:Bug
Ovid on 2008-07-11T08:10:59
Thanks.