BartC <b...@freeuk.com>: > On 17/03/2016 18:53, Marko Rauhamaa wrote: >> BartC <b...@freeuk.com>: > >>> 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.
Well, you fell in the trap. Most perl programmers would fall in it. Same with bash programmers, including myself. That's why I'm wondering if Python could come to the rescue and offer a solid alternative to bash. You have to go out of your way to get into accidental quoting/escaping problems in Python. Marko -- https://mail.python.org/mailman/listinfo/python-list