in reply to Re^2: split and join, what's the clever way to do it
in thread split and join, what's the clever way to do it

Having been bitten by that myself, are there any documents explaining why split behaves this way rather than the (IMO more sensible) alternative of splitting on a regex if it's /specified as a regex/ and splitting on a plain string if it's 'specified as a plain string'?

Replies are listed 'Best First'.
Re^4: split and join, what's the clever way to do it
by ikegami (Patriarch) on Jan 28, 2008 at 01:10 UTC
    That would have prevented the dynamic construction of split regex patterns in the pre-qr// world, and backwards compatibility prevents us from doing that now (whether it's wise or not).
Re^4: split and join, what's the clever way to do it
by ysth (Canon) on Jan 28, 2008 at 02:52 UTC
    Not just split; =~ EXPR is implicitly a match operation using the result of EXPR as the regex. Though the tendency to use quotes instead of // for split, e.g. split "\t" seems to have introduced more confusion about split's operand. (Well, that and the special split " " mode.)