#!/usr/bin/perl -w $regex = "s/foo/bar/g"; $compiled = qr/$regex/; # program works the same # whether I do this or not $string = "foo fru foodyfoo"; $string =~ $compiled; print "$string\n"; # no substitution! $string is still # "foo fru foodyfoo" instead of # "bar fru bardybar".