in reply to Unix-Windows pathnames

Hi props,

In perl, the '/' works fine on Windows. The directory '/home/me/test/' would translate to 'X:\home\me\test' on Windows (where X is the current drive).

In the code you provided, $path is a relative path. Shouldn't it be an absolute path ('/home/me/test') ? I suspect that the code will do as you want if you assign to $path with:
$rel_path = File::Spec->abs2rel('/home/me/test');
That's assuming that '/home/me/test' exists and is, in fact, the directory you want to switch to.

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: Unix-Windows pathnames
by props (Hermit) on Oct 14, 2007 at 08:13 UTC
    Many thanks syphilis i can chdir fine now.