use strict; use warnings; { package Foo; sub pos { "pos" } sub bar { my $foo = "xxx"; $foo =~ m/x/g; return pos $foo; }; }; use Test::More 'no_plan'; is( Foo->pos, "pos", "we can call Foo's pos method" ); is( Foo->bar, 1, "and still use pos inside the package" );