#! /usr/bin/perl use strict; use warnings; { package SomePackage; use Exporter 'import'; our @EXPORT = ( 'hello' ); sub hello (&) { print "hello\n" } # works with the prototype inside the package hello { die "should not be called" } } SomePackage->import( 'hello' ); # works outside the package with a fully qualified name SomePackage::hello { die "should not be called" }; # works outside the package if we ignore prototypes hello( sub { die "should not be called" } ); # perl does know what the prototype is print "prototype is ", prototype \&hello, "\n"; # and yet... hello { die "should not be called" }; #### do { die 'should not be called' }->hello;