📘 Prefix operator temp in Perl 6

📘 Prefix operator temp in Raku

N. B. Perl 6 has been renamed to Raku. Click to read more.


temp creates a temporary variable and restores its value at the end of the scope (like it does the local built-in operator in Perl 5).

my $x = 'x';
{
    temp $x = 'y';
    say $x; # y
}
say $x;     # x

Compare it with the following operator, let.

Leave a Reply

Your email address will not be published. Required fields are marked *