smartmatch

Perl 5.20 and the fate of smart matching and given-when?

我们两清 提交于 2019-12-17 05:05:08
问题 I just installed Perl 5.18, and I get a lot of warnings like this, given is experimental at .\[...].pl line [...]. when is experimental at .\[...].pl line [...]. Smartmatch is experimental at C:/strawberry/perl/site/lib/[...] line [...]. Looking into these warnings -- which I've never heard mentioned anywhere -- I was only able to find this in two places, perldelta for 5.18, which only really mentions insofar as to say that the feature has been downgraded to experimental ? this nntp.perl.org

Why does smartmatch return different values depending on the order of the operands?

故事扮演 提交于 2019-12-08 16:22:54
问题 I have an array for which the following test returns true: 1 ~~ @a And yet, the following test returns false: @a ~~ 1 I read in Learning Perl that the placement of the values on either side of the smartmatch operator doesn't matter, but obviously in the above code it does. Why is that? Are the two statements checking different things? 回答1: In addition to the other answers, the list of Perl 5.10.1 changes has a section on changes made to the ~~ operator: The smart match operator ~~ is no

What does “ ~~ ” mean in Perl?

淺唱寂寞╮ 提交于 2019-12-01 14:57:50
In an SO answer daxim states: @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

What does “ ~~ ” mean in Perl?

这一生的挚爱 提交于 2019-12-01 13:44:35
问题 In an SO answer daxim states: @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

How fast is Perl's smartmatch operator when searching for a scalar in an array?

∥☆過路亽.° 提交于 2019-11-27 13:44:12
问题 I want to repeatedly search for values in an array that does not change. So far, I have been doing it this way: I put the values in a hash (so I have an array and a hash with essentially the same contents) and I search the hash using exists . I don't like having two different variables (the array and the hash) that both store the same thing; however, the hash is much faster for searching. I found out that there is a ~~ (smartmatch) operator in Perl 5.10. How efficient is it when searching for

Perl 5.20 and the fate of smart matching and given-when?

拥有回忆 提交于 2019-11-26 20:38:58
I just installed Perl 5.18, and I get a lot of warnings like this, given is experimental at .\[...].pl line [...]. when is experimental at .\[...].pl line [...]. Smartmatch is experimental at C:/strawberry/perl/site/lib/[...] line [...]. Looking into these warnings -- which I've never heard mentioned anywhere -- I was only able to find this in two places, perldelta for 5.18 , which only really mentions insofar as to say that the feature has been downgraded to experimental ? this nntp.perl.org post The Perl Delta still does the most to give mention as to what's happening with those features, it