@array ~~ $scalar is true when $scalar is in @array
to which draegtun replies:
From 5.10.1+ the order of ~~ is important. Thus it needs to be $scalar ~~ @array
How about a small primer on ~~
with link(s) to source(s) including the following specific questions: What is ~~
? What is ~~
called? Why does the order matter in one version but not in a previous one?
Note that a good summary may not get all the details and can be hard to write. An introduction or primer would be very useful to save time for someone unfamiliar with ~~
while expanding the exposure of this Perlism.
Search strings: non-word-tilde-tilde
non-word-at-sign
.
~~
in Google or on perldoc.perl.org results in no hits. Google is filtering it out, and perldoc just doesn't seem to find it (or "smart match" btw...). Unfortunately SO's search engine doesn't seem to like it either.... maybe a thread should be started in meta to discuss fixing this issue, since no characters should be out of bounds when searching in a programmer's QA site.