use strict; use warnings; sub foo { print 'x' } { no warnings; sub foo { print 'y' } } foo();