I know this is probably a stupid question but that's only because I am a stupid person. Sorry if my question makes you groan with disgust. I like chicken.#!/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".
In reply to Compiling regular expressions to perform substitution by Stegalex
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |