use strict; use warnings; warn "Version $]"; warn "Prototype", prototype "CORE::sleep"; my $sleepcounter; sleep 2; BEGIN { my $old = \&CORE::sleep; *CORE::GLOBAL::sleep = sub { warn "start wrapper $_[0]"; $sleepcounter += $_[0]; $old->(@_); }; } sleep 3; warn "total sleep( $sleepcounter )"; #### Version 5.016003 at d:/Users/lanx/pm/core_sleep.pl line 4. Prototype;$ at d:/Users/lanx/pm/core_sleep.pl line 5. start wrapper 3 at d:/Users/lanx/pm/core_sleep.pl line 16. total sleep( 3 ) at d:/Users/lanx/pm/core_sleep.pl line 26.