in reply to Grepping from an Array using a variable as the pattern to be matched
ikegami already linked to the docs and provided two solutions.
I just want to point out, that you are using the quantifier * as first character in your expression, which can't work, because a quantifier must follow another expression (character, character class, group, ...). Refer to the docs for more details.
$ perl -wle ' q~hello~ =~ m/*ello/ and print "yeah";' Quantifier follows nothing in regex; marked by <-- HERE in m/* <-- HER +E ello/ at -e line 1. $ perl -wle ' q~hello~ =~ m/.*ello/ and print "yeah";' yeah
|
|---|