Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Is there a Limit on Matching .*

by graff (Chancellor)
on Jul 15, 2003 at 04:57 UTC ( #274279=note: print w/ replies, xml ) Need Help??


in reply to Is there a Limit on Matching .*

Just a nit-pick: this use of $/ seems inappropriate:

$/ = '</h1>';
considering that you don't seem to expect the close tag to always be lower case... I presume you had a reason for including the "i" flag on this regex:
$chunk =~ m%<h1>(.+)</h1>%i;
And of course, the value of $/ cannot be treated as a regex -- it has to be a literal string.

Actually, given that you can "guarantee" only one "h1" tag in an html file, if it happens to be capitalized, you'll just slurp the whole file into $chunk, and the remaining logic will work in any case. But don't fall into a false sense of safety about this sort of usage -- it'll trip you someday.


Comment on Re: Is there a Limit on Matching .*
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://274279]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2014-09-19 17:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (143 votes), past polls