Perl Programming/Keywords/END

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Previous: elsif Keywords Next: endgrent

The END keyword[edit | edit source]

END is one of five code blocks that are executed at the beginning and end of a program by Perl. It creates the block that is executed short before the Perl interpreter stops execution. This block is even executed after a die operation, but not after an exec or when killed by a OS signal.

Although it can be prefixed with sub, this is not considered a good programming practice, as these blocks are not a subroutine.

Syntax[edit | edit source]

  END BLOCK

See also[edit | edit source]

Previous: elsif Keywords Next: endgrent