If you do it this way, you have to be very careful with the contents of
$re - you have a quoting context in the
s/// which is defined within a quoting context, so for
s!\\!/!g you'd have to pass
's!\\\\!/!g'. It's much easier to screw up this way than by passing a subref or a compiled RE and a string to eval in the right side of an
s///ee;.
Makeshifts last the longest.