In Phasers§

See primary documentation in context for BEGIN

Runs at compile time, as soon as the code in the phaser has compiled, only runs once.

The return value is available for use in later phases:

say "About to print 3 things";
for ^3 {
    say ^10 .pick ~ '-' ~ BEGIN { say  "Generating BEGIN value"; ^10 .pick }
}
# OUTPUT:
# Generating BEGIN value
# About to print 3 things
# 3-3
# 4-3
# 6-3

The ^10 .pick in the phaser is generated only once and is then re-used by the loop during runtime. Note how the say in the BEGIN block is executed before the say that is above the loop.