sub tobase { my $radix = int($_[0]); (my $num = int($_[1])) =~ y/-/_/; + chomp(my $str = `dc -e${radix}o${num}p`); $str } print tobase(13, 54), "\n"; # outputs 42
Update: fixed the syntax errors, I've no idea how I got them there, sorry.
In reply to Re: Opposite of strtol?
by ambrus
in thread Opposite of strtol?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |