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.