http://www.perlmonks.org?node_id=1197867


in reply to Re: Math::Base - arithmetics with baseX integers
in thread Math::Base - arithmetics with baseX integers (updated)

What I did is to mimic the behavior of sprintf and hex in encode(), i.e. roll over:

$num = (~abs($num))+1 if $num < 0;

And the return line now reads:

return join( '', reverse @ret) || 0;

I've updated the op with the new version. Thanks for your hints!

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'