I found this in Mail::IMAPClient. Where does the $_ in $SEARCH_KEYS{ uc($_) } come from?
sub _quote_search {
my ( $self, @args ) = @_;
my @ret;
foreach my $v (@args) {
if ( ref($v) eq "SCALAR" ) {
push( @ret, $$v );
}
elsif ( exists $SEARCH_KEYS{ uc($_) } ) {
push( @ret, $v );
}
elsif ( @args == 1 ) {
push( @ret, $v ); # <3.17 compat: caller responsible for quoting
}
else {
push( @ret, $self->Quote($v) );
}
}
return @ret;
}
That looks to me like a typo where the author converted an anonymous for loop
foreach (@args)to one with an explicit iterator variableforeach my $v (@args)and forgot to convert all the incidences of$_to$v.You should probably file a bug against the distribution on CPAN.