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.
--chargrill
$,=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[$%++]}
| [reply] [d/l] [select] |
Wouldn't it be more straightforward to do it like this:
$string =~ s/^/a/;
| [reply] [d/l] |
I think I red somewhere that using the variables like $1 which you get from that regular exopression makes you program slower!
Luca | [reply] |