On Mon, 21 Jun 2004, ZZT wrote:
> Hi,
>
> I'd like to get the directory of the currently running script (not the
> working directory) but without concat constructs with $0 and getcwd().
> Is there an easy way, an internal or ENV var?
>
> thanks a lot
You might want a combination of File::Basename::dirname and
File::Spec::rel2abs. Something like this, perhaps:
[untested]
#!/usr/bin/perl
use strict;
use warnings;
use File::Basename;
use File::Spec;
my $dir = File::Spec->rel2abs(dirname($0));
print "$dir\n";
Paul Lalli
|