The Weekly Challenge - 360

Monday, Feb 9, 2026| Tags: Perl, Raku

TABLE OF CONTENTS


  1. HEADLINES

  2. SPONSOR

  3. RECAP

  4. PERL REVIEW

  5. RAKU REVIEW

  6. CHART

  7. NEW MEMBERS

  8. GUESTS

  9. TASK #1: Text Justifier

10. TASK #2: Word Sorter


HEADLINES


Welcome to the Week #360 of The Weekly Challenge.

Recent contributions to past challenges in C have jumped it from rank #9 to #7. Congratulations to all C contributors.

There’s a tough fight between Ruby and Haskell. Let’s see if Ruby can hold its position.

By the way, we got our first centurion week of 2026, a week with 100+ contributions, and it was Week #358.

We’ve had a decent start to the year, so well done Team PWC.



Below is my contributions to the Task #1 of Week #359.

Perl: source code

sub digital_root_additive_persistence {
    my $num = shift;

    return (0, $num) if $num < 10;

    my $sum = 0;
    $sum += $_ for split //, $num;
    my ($count, $root) = digital_root_additive_persistence($sum);

    return ($count + 1, $root);
}

Raku: source code

sub digital-root-additive-persistence(Int $num) {
    return (0, $num) if $num < 10;

    my $sum = $num.comb.sum;
    my ($count, $root) = digital-root-additive-persistence($sum);

    return ($count + 1, $root);
}

Python: source code

def digital_root_additive_persistence(num):
    if num < 10:
        return (0, num)

    digit_sum = sum(int(digit) for digit in str(num))
    count, root = digital_root_additive_persistence(digit_sum)

    return (count + 1, root)

Thank you Team PWC, once again.

Happy Hacking!!


Last 5 weeks mainstream contribution stats. Thank you Team PWC for your support and encouragements.

  Week      Perl       Raku       Blog   
   355       51       23       24   
   356       44       18       13   
   357       50       23       25   
   358       53       23       27   
   359       52       20       21   

Last 5 weeks guest contribution stats. Thank you each and every guest contributors for your time and efforts.

  Week      Guests       Contributions       Languages   
   355       17       69       21   
   356       13       39       11   
   357       16       69       19   
   358       17       69       20   
   359       18       68       23   

TOP 10 Guest Languages


Do you see your favourite language in the Top #10? If not then why not contribute regularly and make it to the top.

 1. Python     (4107)
 2. Rust       (1099)
 3. Ruby       (867)
 4. Haskell    (863)
 5. Lua        (837)
 6. C++        (690)
 7. C          (647)
 8. Go         (634)
 8. JavaScript (619)
10. BQN        (503)

Blogs with Creative Title


  1. Root Reduction by Arne Sommer.

  2. Reduced Roots by Jorg Sommrey.

  3. quick and dirty! by Luca Ferrari.

  4. Loops Considered by Matthias Muth.

  5. Root It All You Reduce by Packy Anderson.

  6. Persistent reduction by Peter Campbell Smith.

  7. Roots and Digits by Roger Bell_West.

  8. Digital reduction by Simon Green.

  9. Return to Sender by Yitzchak Scott-Thoennes.

10. I Contain Multitudes by Yitzchak Scott-Thoennes.


GitHub Repository Stats


1. Commits: 47,748 (+145)

2. Pull Requests: 13,513 (+46)

3. Contributors: 273

4. Fork: 349

5. Stars: 209



We are looking for sponsor for monthly prize pot of US $50. If anyone interested please get in touch with us at perlweeklychallenge@yahoo.com. Thanks for your support in advance.


RECAP


Quick recap of The Weekly Challenge - 359 by Mohammad Sajid Anwar.


PERL REVIEW


If you missed any past reviews then please check out the collection.


RAKU REVIEW


If you missed any past reviews then please check out the collection.


CHART


Please take a look at the charts showing interesting data.

I would like to THANK every member of the team for their valuable suggestions. Please do share your experience with us.


NEW MEMBERS


Please find out How to contribute?, if you have any doubts.

Please try the excellent tool EZPWC created by respected member Saif Ahmed of Team PWC.


GUESTS


Please check out the guest contributions for the Week #359.

Please find past solutions by respected guests. Please share your creative solutions in other languages.


Task 1: Text Justifier

Submitted by: Mohammad Sajid Anwar

You are given a string and a width.

Write a script to return the string that centers the text within that width using asterisks * as padding.

Example 1

Input: $str = "Hi", $width = 5
Output: "*Hi**"

Text length = 2, Width = 5
Need 3 padding characters total
Left padding: 1 star, Right padding: 2 stars

Example 2

Input: $str = "Code", $width = 10
Output: "***Code***"

Text length = 4, Width = 10
Need 6 padding characters total
Left padding: 3 stars, Right padding: 3 stars

Example 3

Input: $str = "Hello", $width = 9
Output: "**Hello**"

Text length = 5, Width = 9
Need 4 padding characters total
Left padding: 2 stars, Right padding: 2 stars

Example 4

Input: $str = "Perl", $width = 4
Output: "Perl"

No padding needed

Example 5

Input: $str = "A", $width = 7
Output: "***A***"

Text length = 1, Width = 7
Need 6 padding characters total
Left padding: 3 stars, Right padding: 3 stars

Example 6

Input: $str = "", $width = 5
Output: "*****"

Text length = 0, Width = 5
Entire output is padding

Task 2: Word Sorter

Submitted by: Mohammad Sajid Anwar

You are give a sentence.

Write a script to order words in the given sentence alphabetically but keeps the words themselves unchanged.

Example 1

Input: $str = "The quick brown fox"
Output: "brown fox quick The"

Example 2

Input: $str = "Hello    World!   How   are you?"
Output: "are Hello How World! you?"

Example 3

Input: $str = "Hello"
Output: "Hello"

Example 4

Input: $str = "Hello, World! How are you?"
Output: "are Hello, How World! you?"

Example 5

Input: $str = "I have 2 apples and 3 bananas!"
Output: "2 3 and apples bananas! have I"


Last date to submit the solution 23:59 (UK Time) Sunday 14th February 2026.


SO WHAT DO YOU THINK ?

If you have any suggestions or ideas then please do share with us.

Contact with me