in reply to Re: Cross platform compatability Part 1: Shells and Files
in thread Cross platform compatability Part 1: Shells and Files

Always, always, always, use '/' as a directory seperator, it works all over the place.

Unless, of course, you're on a Mac (where the directory separator is ':'), or some other operating system with a different directory separator. :)

  • Comment on Re: Re: Cross platform compatability Part 1: Shells and Files

Replies are listed 'Best First'.
Re: Re: Re: Cross platform compatability Part 1: Shells and Files
by ok (Beadle) on Jan 25, 2001 at 04:20 UTC

    Unless, of course, you're on a Mac (where the directory separator is ':'), or some other operating system with a different directory separator. :)

    If you're really worried about the directory separator, do this:

    $dir_separator='/'; open BLARG, "$dir_name$dir_separator$file_name";

    I can't really explain why, but sticking directory separators in a file name makes me cringe. I guess it's because the separator is not a part of the file name.

    There, I guess I did explain why.

      Sorry, not all platforms even use directory separators in that manner. Take a look at File::Spec for the proper way to do this portably.

              - tye (but my friends call me "Tye")