Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: match function

by Corion (Patriarch)
on Jun 09, 2020 at 19:01 UTC ( [id://11117880]=note: print w/replies, xml ) Need Help??


in reply to match function

What is your question?

I think the error message is quite clear:

Unmatched [ in regex; marked by <-- HERE in m/([ <-- HERE B|b)

There is an unmatched opening square bracket in your regular expression.

Your regular expression is

/([B|b)/

Maybe you wanted to write [Bb], or maybe ([B|b])? But that's not what you wrote.

Also, the following code will most certainly not do what you think it does:

if ($_ = /([A|a])/) {

Most likely, you want to use the regex binding operator =~ and not the assignment operator =.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-25 15:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found