in reply to Re: difference between 'if (condition) { expression;}' and 'expression if (condition)'
in thread difference between 'if (condition) { expression;}' and 'expression if (condition)'
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 @_;
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
|
|---|