develooper Front page | perl.perl6.users | Postings from August 2022

Re: BEGIN {} question

Thread Previous | Thread Next
Elizabeth Mattijsen
August 29, 2022 07:44
Re: BEGIN {} question
Message ID:
> Question, would BEGIN go at the top or the bottom
> of my code?  Seems the compiler would hit it first
> at the top, but I do not know if it makes a full
> pass of everything before firing off the BEGIN.

BEGIN runs at *compile* time.

This means that anything before the BEGIN statement in the code, is compiled and known and can be referenced in the BEGIN block.

Anything *after* the BEGIN statement is still unknown to the compiler and can therefore *not* be referenced.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About