Here's two thoughts. elsif and a dispatch table were other thoughts.
# A ternary $test_nums = ( $total_nums <= 30 ? 1 : $total_nums <= 60 ? 2 : $total_nums <= 90 ? 3 : $total_nums <= 120 ? 4 : $total_nums <= 150 ? 5 : $total_nums <= 180 ? 6 : undef ); # Simple division use POSIX 'ceil'; $test_nums = ceil( $total_nums / 30 );
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
In reply to Re: condensing code
by diotalevi
in thread condensing code
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |