In this piece of code, shift is used twice, even though the method only takes one parameter:
sub regexVerify ($)
{
my $re = shift;
return sub
{
local $_ = shift;
m/$re/ ? $_ : undef;
};
}
What does this make the value of local $_, once shift is used again? I was (perhaps naively) assuming that shifting into nothingness would result in undef. But if that were true, this line has no meaning, right?:
m/$re/ ? $_ : undef;
The above sub is called like:
regexVerify (qr/^([a-z].*)?$/i);