Is it possible to simplify this regex and still capture all groups?
my $str = "1 2 3 4 ;";
$str =~ /(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+/;
print Dumper( [$1, $2, $3, $4] );
Output:
$VAR1 = [
'1',
'2',
'3',
'4'
];
I tried using a quantifier to simplify:
$str =~ /(?:(\d+)\s+){4}/;
but it gives:
$VAR1 = [
'4',
undef,
undef,
undef
];