in reply to pass variable at load time

You can set global variable in BEGIN block before use Max; line;

BEGIN { $Max::robi = 'dbname'; }; use Max;

And

package Max; use strict; use DBI; use Carp; croak '$Max::robi undefined' unless defined $Max::robi; my $dbh = DBI->connect("dbi:SQLite:dbname=$Max::robi", "", "",{RaiseEr +ror=>1, AutoCommit=>1});