in reply to small regex issue

It would help if you explained what problems you're having.

If you're not understanding what =~ and s/// do, or what the parentheses are for, read perlretut.

If the script is stopping with an error message, show us the script and the (exact) message.

If none of the above helped, try How do I post a question effectively?.