79425878

Date: 2025-02-10 00:01:30
Score: 0.5
Natty:
Report link

You can make a regular expression match and capture the pieces you want. Looks like you want some text, then a space, then a number, more space(s), and another number?

use strict;
use warnings;

while (my $line = <DATA>) {
    my ($st_name, $val1, $val2) = $line =~ m/^(.+)\s+(\d+)\s+(\d+)/;
    print "$st_name, $val1, $val2\n";
}

__DATA__
Maputsoe 2       1
Butha-Buthe (Butha-Buthe District) 2       1

This prints

Maputsoe, 2, 1
Butha-Buthe (Butha-Buthe District), 2, 1
Reasons:
  • Has code block (-0.5):
  • Ends in question mark (2):
  • High reputation (-1):
Posted by: Robert