On 17/03/2016 18:53, Marko Rauhamaa wrote:
BartC <[email protected]>:
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"));
Yeah, it needs your quotemeta line (whatever that does). But the call is unaffected as the clutter is in the function.
-- bartc -- https://mail.python.org/mailman/listinfo/python-list
