If you have a line in memory and you know you want to get the 1st, 4th and 5th terms, why not just grab those terms?
#!/usr/bin/perl use strict; use warnings; my $ham = "spam\tspam\tspam\t\tyam\tclam"; my @jam; for my $i (0, 3, 4) { push @jam, $ham =~ /(?:[^\t]*\t){$i}([^\t]*)/; } print join("\n", '**', @jam, '**', '');
You could even code that into a single expression if you only wanted to run it once.
In reply to Re: How to capture quantified repeats?
by kennethk
in thread How to capture quantified repeats?
by whatever
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |