To use lib, you must use the full path, and you should not use the relativ path like this.
use '../lib';
Scenario: your scripts in /bin/prog.pl, your lib is something / lib / lib.pm.
If you use the relativ path, you should call your program as follows:
cd something/bin/ && ./prog.pl
If you want to use the relativ path, use FindBin to find your current path:
use FindBin; use lib "$FindBin::Bin/../lib";
Then you could call your program from anywhere where it always finds its lib realiv for itself.
cd ~ something/bin/prog.pl
source share