which still has a problem: unecessary parenthesis creating single-elements lists, each containing a boolean.if (($i == 7) || ($i == 14) || ($i == 21) || ($i == 28) || ... ) {
This is wrong. Context creates the list not parentheses. Consider the following code. All the print statements are executed.
~my @ar = ( 0); # Could be: @ar = 0; no precedence problem unless ( 0 ) { print "0 is false!\n"; } unless ( (0) ) { print "(0) is false! But a list w/ 1 item is true.\n"; } if ( @ar ) { print "\@ar, non-empty array is true!\n"; } unless ( list_context() ) { print "scalar context!\n"; } sub list_context { return 1 if wantarray; return; }
In reply to Re: Re: Variables in variable names
by rir
in thread [untitled node, ID 216639]
by Samn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |