- or download this
$data =~ /^(?:(\d+)\s*(?{ push @results, $^N }))+$/;
- or download this
my @results;
while (<DATA>) {
...
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
- or download this
line 1: 1-2-3-4-5
line 2: 2-3-4-5-6
line 3: 3-4-5-6-7
- or download this
while (<DATA>) {
my @results;
/^(?:(\d+)\s*(?{ push @results, $^N }))+$/;
print "line $.: ", join('-', @results), "\n";
}
- or download this
line 1: 1-2-3-4-5
line 2:
line 3: