how would I make it so that it returns something when the result is zero
It currently puts 0 in @digits. Adjust the last line as desired.
@digits = 0 if !@digits;
I just would rather not have to use a cpan module for such a simple task
Well, it was complex enough that you wanted help with it. I'm also convinced mine can give the wrong result due to floating point error.
my @digits; do { unshift @digits, $num % 20; $num = ( $num - ( $num % 20 ) ) / 20; } while $num > 0;
In reply to Re^3: Base20 Blues
by ikegami
in thread Base20 Blues
by JimDuyer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |