You are viewing the version of this documentation from Perl blead. This is the main development branch of Perl. (git commit 34f84ef118cf4d76aad5b6ead3a2a7ec3cc9f00d)
__SUB__

A special token that returns a reference to the current subroutine, or undef outside of a subroutine.

The behaviour of __SUB__ within a regex code block (such as /(?{...})/) is subject to change.

This token is only available under use v5.16 or the "current_sub" feature. See feature.