"Brian Ling" wrote:
> Hi all,
>
> I have the following bit of code that works out the directory path to
> the currently executing script.
>
> My $path = $0;
> $path =~ s#(^/.+/).+$#$1# ;
>
> This works but doesn't make me happy, is there a better way?

If you're doing other path manipulation in the script then you could
use File::Spec or File::Basename, but otherwise all I can do is tidy
up your code for you:

    my ($path) = $0 =~ m[^.+/]g;

What does it take to make you happy? :-D

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to