in reply to Re^3: Surprised by split
in thread Surprised by split

What do you mean by that? qr? Then you still need to escape the pipe.

That's true. I never indicated anything to the contrary.

What on earth do you mean by that?

The suggestion to use a character class makes split happy, even when passed a string instead of a proper regular expression. That makes it easier for people who don't know enough about the language they're using to get things working. This is certainly one way to accomplish the goal. Another way would be for those people to actually learn the language, instead of learning ways to hack around their lack of knowledge. I am simply advocating the latter strategy over the former.

Replies are listed 'Best First'.
Re^5: Surprised by split
by Anonymous Monk on Aug 12, 2005 at 08:55 UTC
    I never suggested to use the character class to make split happy. split has nothing to do with - except that the problem illustrated itself with split. A character class was used to avoid using a backslash - as the behaviour of a backslash varies when "", '' and // is used - and might subsequent problems when strings are being interpolated in regular expressions.

    When using character classes, you don't have to worry about the kind of quotes being used - or have to count how many backslashes you need.