perl6/doc/lib/X/Placeholder/Mainline

doc src
(title) X::Placeholder::Mainline
    class X::Placeholder::Mainline is X::Placeholder::Block

 
Thrown when a placeholder variable is used in the mainline, i.e. outside of any explicit block. Example:
    $^x

 
Produces the error message
    Cannot use placeholder parameter $^x in the mainline

 
Note that this error can also occur when you think something is a block, but it really is a L<< postcircumfix:<{ }> >>, for example
    my %h;
    say %h{ $^x };
    #     ^^^^^^^  not a block, so $^x is part of the mainline

 

Perl 6 Tricks and Treats newsletter

Register to the free newsletter now, and get updates and news.
Email:
Name: