my $path; BEGIN { # Code that determines the path and stores it in $path. $path = "/www/domain/cgi-bin"; } use lib $path; #### use lib do { # Code that determines the path and returns it. "/www/domain/cgi-bin" }; #### sub get_lib_path { # Code that determines the path and returns it. return "/www/domain/cgi-bin"; } use lib get_lib_path(); #### # Hardcoded use lib "/www/domain/cgi-bin";