Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
and the output would be 'this is a bar'my $regex = "foo"; #any pattern, few characters here for simplicity my $string = "this is a foo"; $string =~ s/$regex/'bar'/ge; print $string;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: $variable as regex in s///
by liverpole (Monsignor) on Jul 20, 2006 at 19:33 UTC | |
|
Re: $variable as regex in s///
by philcrow (Priest) on Jul 20, 2006 at 19:20 UTC |