All of the following satisfy your criteria, are valid and normal Perl code, and would get a semicolon incorrectly inserted based on your criteria:
use softsemicolon;
$x = $a
+ $b;
$x = 1
if $condition;
$x = 1 unless $condition1
&& $condition2;
Yes in cases 1 and 2; In case 3 if the scanner always returns previous token (one token lookahead) this will be detected (no Perl statement can start with && )
As for "valid and normal" your millage may vary. For people who would want to use this pragma it is definitely not "valid and normal". Both 1 and 2 looks to me like frivolities without any useful meaning or justification. Moreover, case 1 can be rewritten as:
The case 3 actually happens in Perl most often with regular if and here the opening bracket is obligatory:$x =($a + $b);
Also Python-inspired fascination with eliminating all brackets does not do here any goodif ( ( $str=~/a\[s\]/ || $str =~/h\[s\]/ ) && ( $str... ) ){ .... }
should generally be written1 2 $a=$b=1; 3 $x=1 if $a==1 4 && $b=2;
I was surprised that the case without brackets was accepted by the syntax analyser. Because how would you interpret the statement $x=1 if $a{$b++}; without brackets is unclear to me. It has dual meaning: should be a syntax error in one case2 $a=$b=1; 3 $x=1 if( $a==1 4 && $b=2);
and the test for an element of hash $a in another.$x=1 if $a{ $b++ };
In reply to Re^12: What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff
by likbez
in thread What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff
by likbez
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |