[ILUG] Path separator in Perl

John Gaughan jgaughan at irish-times.com
Fri May 12 12:36:49 IST 2000


> -----Original Message-----
> From: ilug-admin at linux.ie [mailto:ilug-admin at linux.ie]On Behalf Of Peter
> McEvoy
> Sent: 12 May 2000 12:07
> To: ilug at linux.ie
> Subject: [ILUG] Path separator in Perl
>
> Anyone know of a platform independant way of figuring out what the path
> separator is in Perl (/ vs \)?  (I'm developing on NT for use on a UNIX
> machine, and I'm doing a lot of stuuf with path manipulation/searching).

Hi Peter,

you should be able to use '/' as the path separator under NT, which is
useful since '\' would be interpreted as an escape in some circumstances
(like double-quoted strings).  It would probably make things a lot simpler
to change any paths to use '/' instead of '\'.

There's an article [1] on writing portable Perl on perl.com.  You might find
the section on DOS and its derivatives [2] useful.

John.

[1] http://www.perl.com/pub/doc/manual/html/pod/perlport.html
[2]
http://www.perl.com/pub/doc/manual/html/pod/perlport.html#DOS_and_Derivative
s





More information about the ILUG mailing list