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