develooper Front page | perl.perl6.language | Postings from May 2004

$foo.s/foo/bar/

Thread Next
From:
Juerd
Date:
May 12, 2004 11:22
Subject:
$foo.s/foo/bar/
Message ID:
20040512182247.GU22255@c4.convolution.nl
Juerd skribis 2004-05-12 20:15 (+0200):
> But I think I still want to have some non-mutating version of s/// that
> returns the modified string, so that you can just write something like
>     print s:gx/\w+/WORD/ for <>;

Actually, can't we just use the . for s///? 

You'd then use $foo.s/// to get the new string ang $foo.=s/// to mutate
$foo.

For bare s///, I think copying is more useful than mutating. I'm not
sure, and am posting this before actually thinking about it :)


Juerd

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About