You're misunderstanding what regular expressions do. What they do is detect whether a string satisfies the regular expression's criteria for a match. They don't morph one pattern into another through the magic of quantifiers. You might want the s/// operator:
my $what = 'ram'; $what =~ s/(\Q$what\E)/$1$1$1/; print "$what\n";
Dave
In reply to Re: simple regular expression printing
by davido
in thread simple regular expression printing
by gaurav
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |