in reply to Re: How to Switch off octal interpretation of literal ?
in thread How to Switch off octal interpretation of literal ?

Update: Oops... This post was intended as a reply to this post, not to LanX. | Reparented.

Some general thoughts on "this monster" (if you feel you need a function at all):

sub sdtt() { #sum of digits on Text number local $t =0; map { $t+= $_ } split //, sprintf("%d",$_[0]); return $t; }

Update: And another thing...
    map { $t+= $_ } split //, sprintf("%d",$_[0]);
This is a philosophical nit I'm picking, but I would use for in this type of loop:
    $t += $_ for split //, ...;
I still don't understand why anyone would prefer to use map in a situation like this, i.e., purely for its side-effect(s).


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^4: How to Switch off octal interpretation of literal ?
by gannett (Novice) on Apr 08, 2018 at 09:32 UTC
    Thanks - guidance much appreciated. The sub() {.. definition } just an old bad habit.