foreach my $pwd (split(/\\/,'\foo\foo1\foo2')) { print $pwd, "\n"; }