in reply to qr// and user provided regex patterns...

The main problem is in     if($text =~ $pattern){

You need to put $pattern between slashes like /$pattern/

++ to ikegami I didn't know that. Maybe because I usually match against $_ and so have seldom the need for =~

s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

Replies are listed 'Best First'.
Re^2: qr// and user provided regex patterns...
by ikegami (Patriarch) on Jul 30, 2009 at 06:40 UTC
    Not true, not even if $pattern contained an ordinary string instead of a compiled regex pattern. On the RHS of =~, Perl inserts a match operator if none of the applicable operators is found.