in reply to Insert text in a string

You could also take a regexp approach:
$_ = 'href=www.perlmonks.org'; s!href=!href=http://!gi;

$|=$_="1g2i1u1l2i4e2n0k",map{print"\7",chop;select$,,$,,$,,$_/7}m{..}g

Replies are listed 'Best First'.
Re: Re: Insert text in a string
by blakem (Monsignor) on Jan 19, 2002 at 00:25 UTC
    At the very least, you should use a look-ahead to avoid prefixing 'http://' to strings that already have one...
    s|href=(?!http://)|href=http://|gi;

    -Blake