package VIR; our $vir = qr/My\s+[Rr]egex/; 1; #### #!/usr/bin/perl -w use strict; use lib '/location/of/lib/'; use VIR; $_="My regexen"; print "found\n" if m/$VIR::vir/;