in reply to Re: How to apply modifiers to a substitution via variable?
in thread How to apply modifiers to a substitution via variable?

Except that, since you didn't use strict or warnings, which IMO is just as "deplorable" as using eval, you've got a hidden error:
use strict; use warnings; my $source = "abc"; my $find = "a"; my $replace = "x"; my %opts = ( i => 1, m => 0, s => 0, x => 0, g => 1, ); my $opts = join '', map { $opt{$_}?$_:'' } qw( i m s x ); my $re = "(?$opts:$find)"; if ($opt{g}) { $source =~ s/$re/$replace/g; } else { $source =~ s/$re/$replace/; } print $source;

s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/