BrowserREPL-button-tip-on BrowserREPL-button-tip-off

EditButtonTip 2019-08-04

class X::Placeholder::Mainline

Compilation error due to a placeholder in the mainline

class X::Placeholder::Mainline is X::Placeholder::Block { }
Code

Thrown when a placeholder variable is used in the mainline, i.e. outside of any explicit block.

For example

$^x;
Code

dies with

===SORRY!===
Cannot use placeholder parameter $^x outside of a sub or block
Code

Note that this error can also occur when you think something is a block, but it really is a postcircumfix:<{ }>, for example

my %h;
say %h{ $^x };
# ^^^^^^^ not a block, so $^x is part of the mainline
Code