What directory perl script is being run from? - followup

From: R D (rkd_at_myrealbox.com)
Date: 03/19/04


Date: 19 Mar 2004 08:11:02 -0800

Thanks for quick reply.

Cwd didn't work because it gives what directory
you are currently in not the directory the script is in!

Can't get FindBin to work..any idea what's wrong with the following?

my $Bin;
use FindBin qw($Bin);
use lib "$Bin/../lib";
print $Bin;

My apologies for posting aout easy stuff but I don't use Perl
normally..just doing a quick hack to someone else's script!

Thanks again.

"Jürgen Exner" <jurgenex@hotmail.com> wrote in
news:_lE6c.313$VV1.66@nwrddc01.gnilink.net:

> R D wrote:
>> How do I get a *Windows* perl script to figure out what directory
it
>> is being run from/
>
> perldoc Cwd
>
>> exists in?
>
> perldoc FindBin
>
> jue
>
>



Relevant Pages

  • Re: FindBin cannot chdir back problem
    ... Here is a code snippet from my script that calls FindBin: ... use Cwd 'abs_path'; ...
    (comp.lang.perl.modules)
  • Re: FindBin cannot chdir back problem
    ... > Here is a code snippet from my script that calls FindBin: ... > use strict; ... > use Cwd 'abs_path'; ...
    (comp.lang.perl.modules)
  • Re: FindBin cannot chdir back problem
    ... >> Here is a code snippet from my script that calls FindBin: ... >> use Cwd; ... > compile time - in which case, just about all the code that you have ...
    (comp.lang.perl.modules)
  • Re: Not able to open a file.
    ... but i dont ... use warnings; ... script is.) ... use FindBin '$Bin'; ...
    (perl.beginners)
  • Re: Not able to open a file.
    ... my script is.. ... the $Bin path', as the value of $Bin would be interpolated into the file string. ... What FindBin ... your program's current working directory is not the directory containing the ...
    (perl.beginners)