in reply to Re: add text to a string
in thread add text to a string
Well, that won't work, but what you're going after would:
$string = "bcde"; $string =~ s/^(.+)$/a$1/;
Update: AM's suggestion does work (my bad), as does mine, and so would betterworld's below. However it just seems a silly way to go about it, with either $string = "a$string"; or $string = 'a' . $string; being the more traditional ways of doing it.
$,=42;for(34,0,-3,9,-11,11,-17,7,-5){$*.=pack'c'=>$,+=$_}for(reverse s +plit//=>$* ){$%++?$ %%2?push@C,$_,$":push@c,$_,$":(push@C,$_,$")&&push@c,$"}$C[$# +C]=$/;($#C >$#c)?($ c=\@C)&&($ C=\@c):($ c=\@c)&&($C=\@C);$%=$|;for(@$c){print$_^ +$$C[$%++]}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: add text to a string
by betterworld (Curate) on May 31, 2006 at 14:54 UTC |