Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: unexpected loop behaviour when pattern matching

by jethro (Monsignor)
on Dec 14, 2009 at 16:00 UTC ( #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
Node Status?
node history
Node Type: note [id://812726]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2018-07-16 20:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (349 votes). Check out past polls.

    Notices?