use File::Spec::Functions qw( catdir ); print catdir('/home/foo/abc', 'bar\baz'); #### /home/foo/abc/bar\baz