This is a little Script to calculate the sum of the given number in Perl:
sub digit_sum { my $out = 0; while($_[0] =~ /(.)/go) {$out += $1;} return($out); }
This is a little Script to calculate the sum of the given number in Perl:
sub digit_sum { my $out = 0; while($_[0] =~ /(.)/go) {$out += $1;} return($out); }