That works great, thanks.
Er, what works great? The article you're replying to has not yet
arrived on my news server, so I have no idea what solution you liked.
Please quote enough context that those of us (the majority, I suspect)
not using Google Groups to read USENET can figure out what you're
replying to.
Taking the example further, I'd like to find
out which strings do not match a particular regex.
For example, I want all the strings that do not match the following
expression (for a year range):
\d{2,}-\d+
How to do this? Negative lookahead?
Perldoc perlop, look for !~
Personally, though, I find !~ slows me down significantly when reading
a program. I don't know why, and I'm perfectly willing to believe it
is because I am a bear of very little brain, but every time I see it,
I mentally end up reading the regex, inverting it, and applying that
inversion to the string. Ugly, I know.
In general, I prefer to negate the test instead of the operator.
Instead of:
if ($string !~ /some regex/) {
...
}
I prefer:
unless ($string =~ /some regex/) {
...
}
-=Eric