Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: unexpected loop behaviour when pattern matching

by jethro (Monsignor)
on Dec 14, 2009 at 16:00 UTC ( [id://812726]=note: print w/replies, xml ) Need Help??


in reply to unexpected loop behaviour when pattern matching

It would be helpful if you posted the script output and especially error messages you get as well. Then we don't need to copy and execute your code just to see what happens

With your script I get an error message: "Unmachted ( in regex; marked by <-- HERE in m/mozilla/5.0 ( <-- HERE macintosh;...". I assume you see the same. It means you have a regex special character in the string you are using as pattern.

The culprit is an opening parenthesis without a closing one, leading to an error message. Solution: Use the function quotemeta() to escape any possible character that could have a special meaning in regexes

  • Comment on Re: unexpected loop behaviour when pattern matching

Replies are listed 'Best First'.
Re^2: unexpected loop behaviour when pattern matching
by jonnyfolk (Vicar) on Dec 14, 2009 at 16:11 UTC
    Apologies - I hadn't seen the error message. I should be more careful

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-04-19 08:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found