sub sdtt() { #sum of digits on Text number local $t =0; map { $t+= $_ } split //, sprintf("%d",$_[0]); return $t; } #### c:\@Work\Perl\monks>perl -wMstrict -le "use List::Util qw(sum); ;; sub sdtt { return sum split //, $_[0]; } ;; for (@ARGV) { print qq{sum of digits of $_ == }, sdtt($_); } " 321023 321 023 sum of digits of 321023 == 11 sum of digits of 321 == 6 sum of digits of 023 == 5