in reply to creating qr from existing regex
Remove the slashes, extract the modifier ("i") (say, in a variable $flags). Keep the core of the regex as a string, in your example that would be .*uba$.
Then put "(?$flags:" in front of it, and ")" behind it. You can use that string ($re) directly as a regex:
edit Oops, one too many colons:
$re = "(?:$flags:$core)";
if($input =~ $re) { ... }
You can also turn it into a regex object:$re = "(?$flags:$core)"; if($input =~ $re) { ... }
$qr = qr/$re/;
In Section
Seekers of Perl Wisdom