On 18. mars 2017 11:54, Elizabeth Mattijsen wrote:
In Perl 5 many people use the syntax to assign the value of a complicated 
expression to be useable inside the if statement:

 if (my $x = frobnicate(42)) {
     say $x

which is very handy and used many times, I completely agree.

But as you said:

In Perl 6, we have a different syntax for that, by using a pointy block:

 if frobnicate(42) -> $x {
     say $x

which is way more elegant. Should this make it wise to have a compile time warning for the former then?

Generally, in Perl 5 and Perl 6, when comparing against a constant, you could 
consider teaching yourself to always put the constant on the left-hand side:

but that applies only when you compare with a constant. (And to be honest, sounds like a suggestion from the 80')


Reply via email to