#!/usr/bin/perl my $pathtolib; BEGIN { $pathtolib = &opentextfile; } # opentextfile must be defined before this line use lib $pathtolib;