BEGIN { $INC{'MyModule.pm'} = __FILE__; package MyModule; use strict; my @things = ( 'thing1' , 'thing2' , 'thing3' , ); sub new { my( $c, $t ) = @_; $c = bless { thing => $t }, $c; $c } sub is_thing { my $self = shift; my $t = $self->{'thing'}; return grep /^$t$/, @things; } 1; } package main; #!/usr/bin/perl -w use strict; use lib('.'); use MyModule; my $thingy = new MyModule ( 'thing2' ); print "yeah!\n" if $thingy->is_thing(); print "boo!\n" unless $thingy->is_thing();