Programming-Idioms

History of Idiom 151 > diff from v13 to v14

Edit summary for version 14 :
New Perl implementation by user [daxim]

Version 13

2018-06-12, 20:55:54

Version 14

2019-09-28, 09:12:17

Idiom #151 Remove string trailing path separator

Remove last character from string p, if this character is the file path separator of current platform.

Note that this also transforms unix root path "/" into empty string!

Idiom #151 Remove string trailing path separator

Remove last character from string p, if this character is the file path separator of current platform.

Note that this also transforms unix root path "/" into empty string!

Extra Keywords
trim
Extra Keywords
trim
Imports
use File::Spec qw();
Code
chomp $p, File::Spec->catdir('');
Doc URL
http://p3rl.org/File::Spec#catdir