Perl Programming/Keywords/sub

The sub keyword
The sub keyword defines a subroutine. Without a BLOCK, it is a forward declaration. By an assignment larger or shorter than LENGTH, the string will grow or shrink respectively to accommodate it. Without NAME, it defines an anonymous function, but returns the CODE ref of the just created closure.