in reply to Re: Re: pattern matching
in thread pattern matching
I think you're trying to use the dollar sign in the second regex to mean "if the word ends with a close-square-bracket", but since the dollar sign there is supposed to mean "end of string", you're supposed to place it at the end of the pattern, like this:if ($word =~ /^\[/ && $word =~ /$\]/)
But as others have pointed out, there is room for quite a few other improvements to the code...if ($word =~ /^\[/ && $word =~ /\]$/)
|
|---|