in reply to simple regular expression printing

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

Replies are listed 'Best First'.
Re^2: simple regular expression printing
by gaurav (Sexton) on Jul 15, 2013 at 08:08 UTC

    Thanks Dave