There's more than one way to do things | |
PerlMonks |
Re: Repeating a capture group pattern within a patternby Anonymous Monk |
on Jul 18, 2024 at 05:46 UTC ( [id://11160667]=note: print w/replies, xml ) | Need Help?? |
You're over thinking it.
my $x = "0.01 NaN 2.30 4.44";Match the form rather than the content of the data: my $r1 = qr/(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/;Or ditch the pattern and split, as others suggest: my ($d, $e, $f, $g) = split /\s+/, $x;
In Section
Seekers of Perl Wisdom
|
|