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

Re: BEGIN {} question

Thread Previous | Thread Next
From:
Elizabeth Mattijsen
Date:
August 29, 2022 07:44
Subject:
Re: BEGIN {} question
Message ID:
459794C2-6EC3-4ECE-A112-9E44E6320441@dijkmat.nl
> 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.


Liz
Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About