$ perl -wle'use File::Spec; print File::Spec->catfile("/foo/", "bar"); print File::Spec->catfile("/foo", "bar");' /foo/bar /foo/bar