A simple little bit of code threw me for a loop for a minute. Never seen it used before:
So there is something in $_. What does the if actually match?
print "yes" if (!/:/);
theperlyking
12:03 pm on Apr 4, 2001 (gmt 0)
Print yes if there is no colon in $_ ? Thats what i'd guess..
sugarkane
8:46 pm on Apr 4, 2001 (gmt 0)
Right, perlyking (correct Brett?)
Okay, let's move it up a notch <g>
What does this match?
print "yes" if (!/(^:¦:$)/);
Brett_Tabke
2:18 am on Apr 5, 2001 (gmt 0)
It would print yes if the colon was not at the end or beginning of the line sk. The pipe is the dual match character where both halves have to match to be true. The up arrow (caret) says to match the colon only if at the start of the line, then the pipe is the "and" match, and the colon $ specifies to only match at the end of the line. Combine that with the not ! character to reverse the tense means that it will only print yes if the colon is NOT at the start AND only if not at the end of the string.
It would match " :" But not match ": " or " :"
I guess my teaser was one everyone but me had seen before.