SUB

NAME
SYNOPSIS
DESCRIPTION

NAME

sub - declare a subroutine, possibly anonymously

SYNOPSIS

sub BLOCK

sub NAME

sub NAME BLOCK

DESCRIPTION

This is subroutine definition, not a real function per se. With just a NAME (and possibly prototypes), it’s just a forward declaration. Without a NAME, it’s an anonymous function declaration, and does actually return a value: the CODE ref of the closure you just created. See the perlsub manpage and the perlref manpage for details.