use Cwd qw(abs_path) question

Discussion in 'Perl Misc' started by Sverre Furberg, Apr 5, 2005.

  1. Hi.
    I was testing the use 'Cwd qw(abs_path)' function
    in a script on my Windows 98 computer and found
    (in my opinion) something strange.

    use strict;
    use warnings;
    use Cwd qw(abs_path);

    my $file = shift;
    my $abs_path = abs_path($file);
    print $abs_path, "\n";

    __END__

    If i run the script with 'a normal file' as argument like this:
    C:\Temp>perl pwdtest.plx text.txt
    I get:
    C:\Temp\text.txt
    with backslashes.

    Now if i run the script with a directory as argument:
    C:\Temp>perl pwdtest.plx testdir
    I get:
    C:/Temp/testdir
    with frontslashes like in *nix.
    Why is that?
    It's not a problem but I'm curious.
    Sverre
    Sverre Furberg, Apr 5, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Burganovsky
    Replies:
    1
    Views:
    450
    Mark Rae
    Dec 15, 2005
  2. Burganovsy
    Replies:
    0
    Views:
    445
    Burganovsy
    Dec 11, 2005
  3. Tim Black
    Replies:
    2
    Views:
    435
    Steve Christensen
    Sep 9, 2004
  4. Kamilche

    More elegant way to cwd?

    Kamilche, Dec 24, 2004, in forum: Python
    Replies:
    11
    Views:
    495
    Peter Hansen
    Dec 29, 2004
  5. pt

    abs_path($0) gags

    pt, Apr 20, 2005, in forum: Perl Misc
    Replies:
    1
    Views:
    193
Loading...

Share This Page