Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

directory separator

by perchance (Monk)
on May 14, 2001 at 14:53 UTC ( #80179=perlquestion: print w/replies, xml ) Need Help??

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://80179]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2020-01-22 19:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?