On Wed, 5 Feb 2014 19:52:07 +0000
Jorge Almeida <jjalme...@gmail.com> wrote:

> $s="ab";
> $s=~s/a/AA/; # $s is now "AAb"
> 
> 
> I would like to achieve the same with something similar to the x
> multiplier:
> 
> $n=2;
> $s="A"x$n."b"; # $s is "AAb"
> 
> $s="ab";
> $n=2;
> $s=~s/a/Ax$n/; # doesn't work, of course; $s is Ax2b

    $s =~ s/a/"A"x$n/e;

> 
> Is it possible at all?

See: `perldoc -f s` and search for: s/PATTERN/REPLACEMENT/msixpodualgcer

> 
> Thanks
> 
> Jorge Almeida
> 



-- 
Don't stop where the ink does.
        Shawn

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to