in reply to Need clean code

You mentioned: $var or $var = 30;

Better as:

$var ||= 30;
which assigns the value if the value of $var is not true. If your code allows $var to be defined but not true at that point (e.g. hold a value of '0'), then use:
$var //= 30;
which will only assign the value to $var if it is undefined.

See perlop for more information.

Hope this helps!


The way forward always starts with a minimal test.