in reply to Platform independant directory separator

Before File::Spec, this is what I used. It still works today and it worked on very old perls on every Unix-like and Windows platforms that I've ever encountered.

Basically, the idea is to ask perl what it uses as directory separator char.

Sample use ($dirSep gets either back or forward slash character):

$dirSep = ( $ENV{"PATH"} =~ m/;[a-z]:\\/i ) ? '\\' : '/' ; print $dirSep;

Replies are listed 'Best First'.
Re^2: Platform independant directory separator
by Anonymous Monk on Apr 19, 2023 at 06:05 UTC
    Before File::Spec,

    so 26 years ago, why relevant today??