use Cwd qw(abs_path) question

S

Sverre Furberg

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top