use Path::Class; my $path = file('', qw[ foo bar baz baz.txt ]); # The '' is to make it absolute. See comment in the doc. print $path, "\n"; print $path->as_foreign('Unix'), "\n"; __END__ \foo\bar\baz\baz.txt /foo/bar/baz/baz.txt