๐Ÿ“˜ 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 *

Retype the CAPTCHA code from the image
Change the CAPTCHA codeSpeak the CAPTCHA code