use strict; use warnings; use myfirstaddin (); use mysecondaddin (); if (defined $ARGV[0] && $ARGV[0] eq 'second'} { mysecondaddin->import('runonce'); } else { myfirstaddin->import('runonce'); } print "hello world"; runonce(); myfirstaddin::runonce(); mysecondaddin::runonce(); #### # myfirstaddin.pm package myfirstaddin; BEGIN { require Exporter; our @ISA = qw( Exporter ); our @EXPORT_OK = qw( runonce ); } # Other "use" statements go here. sub runonce { print "This is file myfirstaddin."; } 1; #### # mysecondaddin.pm package mysecondaddin; BEGIN { require Exporter; our @ISA = qw( Exporter ); our @EXPORT_OK = qw( runonce ); } # Other "use" statements go here. sub runonce { print "This is file mysecondaddin."; } 1;