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

I know there are modules like File::Spec But what I want to do is just get the delimiter

  • Comment on How to get the path delimiter in current system?

Replies are listed 'Best First'.
Re: How to get the path delimiter in current system?
by syphilis (Archbishop) on Jan 23, 2015 at 09:55 UTC
    Try $Config{path_sep}
    C:\>perl -V:path_sep path_sep=';'; C:\>


    Cheers,
    Rob
      if I understand correctly Config{path_sep} is relative to %ENV, ie what is the separator in the $ENV{PATH}, not path in the sense of directory path.
      perl -MConfig -e "print $Config{path_sep}" ;

      L*
      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: How to get the path delimiter in current system?
by Anonymous Monk on Jan 23, 2015 at 10:08 UTC

    It's actually not that easy, but if this is for a known and limited set of operating systems, see here. If you need this to work on any OS, then it's really nontrivial! But see here for one idea.

Re: How to get the path delimiter in current system?
by Discipulus (Canon) on Jan 23, 2015 at 09:55 UTC
    UPDATE: if i have not misunderstood your question (path intended as directory path not env path entry)
    use File::Util qw( SL ); print SL;
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.