|Subject:||Suggested policy: forbid array on LHS of ~~|
|X-Mailer:||MIME-tools 5.427 (Entity 5.427)|
In perl 5.10.0, when smart matching was first introduced, you could say @a ~~ $x to test list membership (more or less). The semantics of this construct changed in 5.10.1 and now what it tests is whether $x contains a reference to the array @a. I suggest that the new behaviour is not particularly useful in itself (you can test C<ref($x) && $x eq \@a>, if that's what you really want, but you rarely do want that), and so code with the above smart match is most likely to be left over from perl 5.10.0 and will break with newer releases. Perlcritic should warn about C<@a ~~ $x> and suggest changing it to C<$x ~~ @a>, which will do what was probably intended under both 5.10.0 and newer perl versions.