Roland Turner

about | contact

Multiple perl packages inside a perl script

It works:

#!/usr/bin/perl

use strict;
use warnings;

package FOO;

sub foo1 {
    print "foo\n";
}

1;

package MOO;

sub moo1 {
    print "moo\n";
}

1;

FOO::foo1();
MOO::moo1();

Thanks to Dave Cawley for working out how.