in reply to how to add script directory to @INC

Shorter:

use lib $0 =~ m|(.*)/|;

But how about something that actually works instead. What you have there doesn't handle symlinks or non-unix systems.

use Cwd qw( realpath ); use File::Basename qw( dirname ); use lib dirname(realpath($0));