Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: win32/unix compatible code question

by jsprat (Curate)
on Dec 09, 2003 at 19:06 UTC ( #313487=note: print w/replies, xml ) Need Help??


in reply to win32/unix compatible code question

Internally, perl and Windows understand '/' as the separator just fine. If you are using external programs or libraries, all bets are off - some will handle it, some won't.

If you need to change the path separator based on underlying OS, File::Spec's catfile and catdir should help. It's a standard module, and its purpose is to "portably perform operations on file names".

An example:

#!perl use File::Spec::Functions; print catfile( qw/dir subdir file/ ); __END__ On my FreeBSD box, the result is "dir/subdir/file" On my Win2K box , the result is "dir\subdir\file"

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2020-06-02 15:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (19 votes). Check out past polls.

    Notices?