in reply to Re: Path strings
in thread Path strings

When I run:,

my $curdir = File::Spec->rel2abs(File::Spec->curdir());

I am returned an absolute path without a trailing delimiter, which I would expect (like) to see.

Replies are listed 'Best First'.
Re^3: Path strings
by bobf (Monsignor) on Jan 27, 2007 at 05:53 UTC

    A quick look at the source code shows that rel2abs (like many of the functions in File::Spec) calls canonpath. One of the things that function does is remove the trailing delimiter. According to the docs (for catdir, as it turns out), this is because

    it doesn't look good, isn't necessary and confuses OS/2

    I am not as familiar with the functions in Cwd, but after looking at the docs and source code it also appears to leave off the trailing delimiter.

    If you really want a trailing delimiter, then you may have to add it yourself. Sorry. :-)

      With this in mind, I will have to continue with the extra routines to achieve a sturdy solution.

      Thanks for assistance.