Thus the following command is evaluated regardless of filename:yet sometimes an error is created, sometimes not.$error ||= "Unexpected signer 'GOODSIG 86125876138571635 ClientKey' is + not ''." unless ('GOODSIG 86125876138571635 ClientKey' =~ m/\Q\E/);
If the error is created, that's because it is set elsewhere. The code you gave will not change $error when $expected_signer is an empty string. That's because m/\Q$foo\E/ will match anything when $foo is empty. (Every string contains an empty string.) In this snippet, $error is only set unless the match is true. Since it is true, $error isn't set.
Update: Changed "Every string matches an empty string" to "Every string contains an emptry string." The latter is what I really meant (as the context implies.) My thanks go to Enlil for spotting it.
-sauoq "My two cents aren't worth a dime.";
In reply to Re: Regular Expression gotchas ?
by sauoq
in thread Regular Expression gotchas ?
by the_Don
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |