- or download this
# this code is in Foo/Bar.pm
package Foo::Bar;
...
our @EXPORT = qw/baz/;
sub baz { "Hello world"; }
1;
- or download this
use 5.010;
use strict;
use foo::bar;
say Foo::Bar::baz(); # says "Hello world"
- or download this
use 5.010;
use strict;
use Foo::Bar;
say baz(); # says "Hello world"
- or download this
use 5.010;
use strict;
use foo::bar;
say baz(); # dies - undefined subroutine main::baz
- or download this
use 5.010;
use strict;
use foo::bar;
say foo::bar::baz(); # dies - undefined subroutine again