in reply to Reg Ex Needed
A non-regex version. It grabs every second pair of space delimited strings in the line.
my $data = '1 2 3 4 5 6 7 8 9 1 0' print join ' ', grep $_,(split' ', $data)[ map{ my $n = 4 * $_; ( $n, +$n + 1 ) } 0..5 ]; 1 2 5 6 9 1
Adjust 0 .. 5 to suit the maximum number of items/4
Examine what is said, not who speaks.
The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.
|
|---|