Begin at the BEGIN and go on till you come to the END: then stop.
In Perl we can run user defined code blocks at different stages when running a program.
- BEGIN blocks are run as soon as Perl finds them. If there is more than one block they get executed in the order they are found.
- CHECK blocks are run as soon as Perl finishes compiling. If there is more than one CHECK block they get executed in the reverse order they are found.
- INIT blocks are executed after CHECK blocks, and if more than one exists they get executed in the order they appear.
- END blo…