I would like to use the $var variable in lib path.
my $var = \"/home/usr/bibfile;\"
use lib \"$var/lib/\";
However when I do th
Variables work fine in use lib, well, just like they do in any string. However, since all use directives are executed in BEGIN block, your variable will be not yet initialized at the moment you run use, so you need to put initialization in BEGIN block too.
my $var;
BEGIN { $var = "/home/usr/bibfile"; }
use lib "$var/lib/";
use Data::Dumper;
print Dumper \@INC;
Gives:
$VAR1 = [
'/home/usr/bibfile/lib/',
# ... more ...
];