use warnings; 
use strict;

sub f { #function in the main:: namespace
    print "I am the f in main\n";
}

package Second; #change namespace till further notice to "Second"

sub f { #a function in the Second space
    print "I am the f in Second\n";
}

#the two definitions of sub f() do not interfere at all since they are
# in separate namespaces.  They are each global in their own namespace

print "I should still be in the namespace Second, calling f\n";
f(); #call the f() from the Second namespace
# the one in Second is called because this is the current namespace

print "but I can call into the other namespace\n";
main::f(); #by specifying namespace I can call the function from 
        # there too

package main; #revert to the main  namespace
print "I reverted to namespace main, calling f\n";
f(); #and so the main::f will be called
Second::f(); 
