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));
In reply to Re: how to add script directory to @INC
by ikegami
in thread how to add script directory to @INC
by bdimych
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |