Perl include question

Dan Coutu coutu at snowy-owl.com
Mon Dec 5 15:59:01 EST 2005


On Mon, 2005-12-05 at 15:25 -0500, Cole Tuininga wrote:
> How can I set up my include path (within the perl script) to make sure
> that the directory of the executable is in the include path?  I can't
> hard code it because the location might be different on different
> machines (different mount points).
> 
Piece of cake. You need to use the FindBin module that is included in
the default Perl distribution. Do this:

#!/usr/bin/perl
use FindBin qw($Bin);
use lib "$Bin";
use myinclude;

This assumes that your module is named myinclude.pm and is in the same
directory as your perl script.

For more details use "perldoc FindBin" on the command line.

Dan




More information about the gnhlug-discuss mailing list