|
The most devious part is japhy's innocuous comment. $(...) syntax is hogwash!
The $ starts the regex engine matching at the end of the string. Since $` is the portion preceding the current match, it gets set to the entire contents of $_. Now the (??{code}) zero-width assertion comes into play. $` >= $X is evaluated (as a string) and its result inserted into the regex. In Perl, boolean values stringify to "1" or "". So if $_ < $X, the comparison fails (returning ""), so the regex is simply /$/, which always succeeds. Otherwise, the comparison succeeds (returning "1"), and the regex is (equivalent to) qr'$1', which can never succeed. |
blokhead
In reply to Re: Is $_ less than $X
by blokhead
in thread Is $_ less than $X
by japhy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |