[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] the directory where the script is running




Vicki Brown wrote:

> If you want a _portable_ solution, however... it gets harder.

<snip>

> If the script is called by a relative pathname, then $0 contains that
> relative path (and you have to figure out the location by where it is in
> terms of the current directory.)

??

 use Cwd;

 my $pwd = cwd;

 print "I think I am in $pwd\n";

__END__

on a Mac yields:

  I think I am in HD:MacPerl f:

And seems to yield reasonable results on other platforms as well.

Peter Prymmer


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org