Re: Dumb path question
[email protected] (John Delacour)
| Newsgroups | perl.macosx |
|---|---|
| Message-ID | <p06240861c5dc7c78881e@[10.0.0.1]> |
At 21:10 -0600 9/3/09, Doug McNutt wrote: >At 22:24 -0400 3/9/09, Chris Devers wrote: >>How can a Perl script reliably, portably resolve the path inside which >>it is running?... > >$0 That's a zero. Has always worked for me to produce a full path >to a running perl script. > >...There is a module "cwd"... or rather Cwd. $0 will give the name but not the full path, so I'd suggest the following: #usr/bin/perl use Cwd; my $currentdir = cwd(); print "$currentdir/$0\n"; JD