perchance has asked for the wisdom of the Perl Monks concerning the following question:


Does anybody know of an easy way to access the directory seperator?
I need to know what it is for cross-platform purposes.

10x,
me

--- Sweetness Follows

Replies are listed 'Best First'.
Re: directory separator
by Masem (Monsignor) on May 14, 2001 at 15:15 UTC
    There's no direct built in way in perl, but if you use the module File::Spec, which loads up the correct OS-based code depending on where it's run, you can get this information, allowing you to write cross-platform programs.


    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
Re: directory separator
by ckohl1 (Hermit) on May 14, 2001 at 15:28 UTC
    You should also be able to determine the operating system
    through the '$^O' variable.


    Chris
    'You can't get there from here.'
Re: directory separator
by bobione (Pilgrim) on May 14, 2001 at 16:19 UTC
    I heard (and tested) that you can use '/' character for directory separator on Windows and Unix OS.
    It might help you.
    BoBiOne KenoBi ;)
      Yep. Perl on Win32 handles the '/' character fine as a directory separator. Unless your concern has something to do with data you're parsing (ie, a file of directory paths), this should be a non-issue.