dchetlin has asked for the wisdom of the Perl Monks concerning the following question:
So, here are my replies to him -- see the above link for the full context of the conversation.
No need to be embarassed; you didn't do anything wrong. I just wanted to make sure people saw things from all the angles.
No, I wouldn't say fully valid running code is necessarily required, but I do think something like the value of $/ is important info. It seems like just a minor oversight though; definitely not a big deal.
Well, why is the binmode there? An HTML file is a text file, not a "binary" file. I'm no Windows programmer, so I can't say for sure, but I'd think that using binmode on an HTML file would be a bad idea. And I certainly can't see it serving any purpose here.
re is a pragma in the core distribution, and one of the options to it is `debug'. If you `use' it in a program, it will verbosely tell you how the Perl REx engine does its matches.
Here's an example of how you might use it:
[~] $ perl -Mre=debug -we'$_ = "abbaba"; /(.).*?\1/' Freeing REx: `,' Compiling REx `(.).*?\1' size 11 first at 3 1: OPEN1(3) 3: REG_ANY(4) 4: CLOSE1(6) 6: MINMOD(7) 7: STAR(9) 8: REG_ANY(0) 9: REF1(11) 11: END(0) minlen 1 Omitting $` $& $' support. EXECUTING... Matching REx `(.).*?\1' against `abbaba' Setting an EVAL scope, savestack=3 0 <> <abbaba> | 1: OPEN1 0 <> <abbaba> | 3: REG_ANY 1 <a> <bbaba> | 4: CLOSE1 1 <a> <bbaba> | 6: MINMOD 1 <a> <bbaba> | 7: STAR Setting an EVAL scope, savestack=3 1 <a> <bbaba> | 9: REF1 failed... REG_ANY can match 1 times out of 1... 2 <ab> <baba> | 9: REF1 failed... REG_ANY can match 1 times out of 1... 3 <abb> <aba> | 9: REF1 4 <abba> <ba> | 11: END Match successful! Freeing REx: `(.).*?\1'
-dlc
|
|---|