http://www.perlmonks.org?node_id=711902


in reply to Re: catfile/catdir collapses two leading slashes //
in thread catfile/catdir collapses two leading slashes //

Sure. But let's not stray off-topic :)
use File::Spec::Functions qw(catdir catpath splitdir splitpath); my ($volume, $directories, $file) = splitpath '//special/semantic//pat +h/definition'; my @dir = splitdir $directories; my $dir1 = catdir @dir; # '/special/semantic/path' my $dir2 = join '/', @dir; # '//special/semantic//path/' my $path1 = catpath $volume, $dir1, $file; # '/special/semantic/path/d +efinition' my $path2 = catpath $volume, $dir2, $file; # '//special/semantic//path +/definition'


There's always confusion with file nomenclature. See File system nomenclature. Death to path!