|Subject:||split /\A/ works like /^/m, matches embedded newlines|
perldoc perlrebackslash: \A "\A" only matches at the beginning of the string. perldoc -f split: Empty leading fields are produced when there are positive-width matches at the beginning of the string; a zero-width match at the beginning of the string does not produce an empty field. Therefore split /\A/ should return the input string as is. \A can only match once (at offset 0), which (logically speaking) should turn "foo" into ("", "foo"), but because of the special case in split of not producing empty leading fields for zero-width matches at the beginning, we just get "foo" again. What actually happens: $ perl -wE 'say "[$_]" for split /\A/, "foo\nbar\nbaz"' [foo ] [bar ] [baz] Apparently split thinks /\A/ is the same as /^/m, matching after every embedded newline in the input string. I think this is a bug in split. The test above was with: This is perl 5, version 12, subversion 4 (v5.12.4) built for x86_64-linux ... but an IRC bot running 5.20.0 produces the same results so I assume it's still present in 5.20.