http://www.perlmonks.org?node_id=349502


in reply to A problem with using the split command

split actually takes a m// for it's first argument, not just a string. Try:
foreach my $pwd (split(/\\/,'\foo\foo1\foo2')) {
The reason it was failing with \\ was that in a string, the '\\' turns into a literal \ after interpolation. That single \ is then passed to the regex engine as the RE, which is invalid as \ is special in a RE.