in reply to Surprised by split

split takes a regular expression as its first argument, and not a string. What tripped you off was the double-interpolation that occurs when using string literals as regular expressions - just don't do that, use regular expressions instead:

split /\|/, $str;