in reply to Regex from a string

Well, this works fine:
$_ = 'Hello my name is A0'; my $r = 'Hello\smy\sname\sis\s(\w.*)'; print $1 if m/$r/;
But I can't figure out how to let the user set flags like i. Eval is generally a bad idea unless you know exactly who is going to be using your script.