use B::Deparse; ... my $string = B::Deparse->new->coderef2text($coderef);