http://qs321.pair.com?node_id=1179954


in reply to Re^3: Feature Idea: qr//e
in thread Feature Idea: qr//e (updated with solutions)

One extra tweak to the prototype would allow you to add trailing modifiers without requiring the pesky quotes around them:
sub qre (&;*) { my $re = shift->(); eval 'qr/$re/'.(shift//'') || die $@ } my $regex = qre{ join '|', qw/foo bar/ }i; print "$regex\n"; __END__
or, from Perl 5.20 onwards:
sub qre :prototype(&;*) { my $re = shift->(); eval 'qr/$re/'.(shift//'') || die $@ } my $regex = qre{ join '|', qw/foo bar/ }i; print "$regex\n";
Damian