package main; Bar::bar(\&foo); sub foo { # do stuff } package Bar; sub bar { # need to call a subroutine provided by the caller my $subref = shift; $subref->(); }