The second example is also buggy and shouldn't be used. Declare the variable in the previous line. The bug is that the runtime effect of my() is avoided when the condition fails.
my $var; $var = 'ok' if @_;
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
In reply to Re^2: difference between 'if (condition) { expression;}' and 'expression if (condition)'
by diotalevi
in thread difference between 'if (condition) { expression;}' and 'expression if (condition)'
by ranjan_jajodia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |