in reply to Re^3: Perl appending \ or / based on windows or linux
in thread Perl appending \ or / based on windows or linux
A couple of examples from a previous thread: The behavior of rsync sometimes depends on whether a pathname has a trailing slash or not. Often file patterns, such as in gitignore, will match only directories if there is a trailing slash on the name.
However, as was argued in that thread, the forward slash is probably fine in all these applications, and so one solution when dealing with them might be File::Spec::Unix->catdir('foo','bar').'/'
The only other actual use case I could come up with since then is displaying things to a user: a trailing directory separator makes it obvious that something is a path at first glance.
So yeah, "I need a trailing slash" is more likely to be an XY Problem than a practical one...
|
|---|