yanick1@sympatico.ca wrote: > Write a subroutine to compute the digital root of any whole number argument. > > Winner: sub hole {$_=pop;1while s/(\d)(\d)/$1+$2/ge;$_} > > Can't this function can be triviality optimized of three whole characters > as > > sub hole {$_=pop;1while s/(.)(.)/$1+$2/e;$_} slightly different but equivalent: sub digital_root {$_=pop;{s/(.)(.)/$1+$2/e&&redo}$_} -- Steve Lane <sml@zfx.com> ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe