On Wed, 18 Oct 2000 yanick1@sympatico.ca wrote: > perlgolf hole - Digital Root > Write a subroutine to compute the digital root of any whole number argument. > > sub hole {pop=~/./;$'?hole($&+$'):$&} So what's wrong with the arithmetic approach? sub hole {$_&&(abs($_)-1)%9+1} If the numbers were known to be positive, ($_-1)%9+1 would suffice. -- Ilmari Karonen - http://www.sci.fi/~iltzu/ "And, should you resort to sticking a martini olive up their nose, implacable universal laws require that they'll _like_ that sort of thing." -- Graydon in r.a.sf.c ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe