Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Portable code: path separator

Status
Not open for further replies.

user2base

Technical User
Oct 16, 2002
29
GB
I am currently writing Perl scripts that use path extensively and I use the "join" function a lot.
I want to use these scripts on both unix and windows and I would like to find a generic way to create my path:
the separator for unix is "/"
for windows it is "\"

Is there a way to do that ?

Thanks in advance for your help.
 
Look into the File::Spec and File::Basename modules. Both take into account the current OS/Platform that the code is being run on... Notorious P.I.G.
 
Don't worry about it, use / even on WinXX boxes.

Perl understands where it's running. Mike

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top