in reply to Re: Conditional initialization of my-variables
in thread Conditional initialization of my-variables
Your example has reinforced my long-held support for Use block if not postfix if
Having struggled to understand code that I wrote just a few years ago that used postfix if conditions, I concluded that if I can't understand it quickly, anyone else would have great difficulty simply because they didn't write it. So now I almost exclusively use conditional blocks.
The one major exception is where the condition modifies the condition variable:
or to add a default valuemy $input = <STDIN>; $input = 10 if $input > 10;
$input = 1 unless $input;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Conditional initialization of my-variables
by eyepopslikeamosquito (Archbishop) on Apr 07, 2023 at 23:32 UTC | |
by LanX (Saint) on Apr 08, 2023 at 12:57 UTC | |
Re^3: Conditional initialization of my-variables
by LanX (Saint) on Apr 07, 2023 at 19:40 UTC | |
by Bod (Parson) on Apr 08, 2023 at 17:55 UTC | |
by LanX (Saint) on Apr 08, 2023 at 18:24 UTC | |
by kcott (Archbishop) on Apr 08, 2023 at 19:49 UTC |