That is not true. No name is required. The {} set the scope of the local. For my demo below, I used an "our" variable, package scope. A Perl Global like $/ acts similar. You cannot localize a "my" variable.
I guess you can think of a local var as sort of like creating a stack of that variable. The local statement is like a "push" and when you exit the scope of the local, that is like a "pop". Rough analogy, but that is descriptive of the behavior.
#!usr/bin/perl
use warnings;
use strict;
our $x = 1; #a package variable
{
print "$x\n"; #prints 1
local $x = 99;
print "$x\n"; #prints 99
}
print "$x\n"; #prints 1, back to before the "local"
|