Strange Perl pattern matching

Matija Nalis mnalis-ml at voyager.hr
Sat Jul 4 14:29:19 UTC 2009


On Sat, Jul 04, 2009 at 11:33:26AM +0200, Julien ÉLIE wrote:
> And the following is fine:
>
>    next if ($ngname !~ /$newsgrouppats/);
>    print "A\n";
>    next if ($exclusionpats and $ngname =~ /$exclusionpats/);
>    print "B\n";
>    next if ($droppats and $ngname =~ /$droppats/);
>    print "C\n";

perlop(1) for m/PATTERN/msixpogc says:

"If the PATTERN evaluates to the empty string, the last successfully matched
regular expression is used instead. In this case, only the "g" and "c" flags
on the empty pattern is honoured - the other flags are taken from the
original pattern. If no match has previously succeeded, this will (silently)
act instead as a genuine empty pattern (which will always match)."

so that is probably the problem.


-- 
Opinions above are GNU-copylefted.



More information about the inn-workers mailing list