@@ -595,7 +595,15 @@ I<Deleting an element in a hash>
595
595
596
596
= head4 C < if > C < elsif > C < else > C < unless >
597
597
598
- Unchanged; parens around the conditions are now optional.
598
+ Mostly unchanged; parens around the conditions are now optional, but if
599
+ used, must not immediately follow the keyword, or it will be taken as a function
600
+ call instead. Binding the conditional expression to a value is also a little different:
601
+
602
+ if (my $x = dostuff()) {...} # Perl 5
603
+ if dostuff() -> $x {...} # Perl 6
604
+
605
+ (You can still use the C < my > form in Perl 6, but it will scoped to the
606
+ outer block, not the inner.)
599
607
600
608
= head4 C < given > C < when >
601
609
@@ -607,7 +615,15 @@ See also the warnings on the smart-match op above.
607
615
608
616
= head4 C < while > C < until >
609
617
610
- Unchanged; parens around the conditions are now optional.
618
+ Mostly unchanged; parens around the conditions are now optional, but if
619
+ used, must not immediately follow the keyword, or it will be taken as a function
620
+ call instead. Binding the conditional expression to a value is also a little different:
621
+
622
+ while (my $x = dostuff()) {...} # Perl 5
623
+ while dostuff() -> $x {...} # Perl 6
624
+
625
+ (You can still use the C < my > form in Perl 6, but it will scoped to the
626
+ outer block, not the inner.)
611
627
612
628
Note that reading line-by-line from a filehandle has changed.
613
629
0 commit comments