BartC <[email protected]>:
> I was going to suggest just using a function. But never having coded in
> Perl before, I wasn't expecting something this ugly:
>
> sub replacewith{
> $s = $_[0];
> $t = $_[1];
> $u = $_[2];
> $s =~ s/$t/$u/;
> return $s;
> }
>
> Although once done, the original task now looks a proper language:
>
> print (replacewith("I have a dream","have","had"));
Now try your function with:
print (replacewith("I have a dream",".","had"));
Marko
--
https://mail.python.org/mailman/listinfo/python-list