>perl -wMstrict -le "use List::MoreUtils qw(natatime); use Data::Dumper; my $s = 'ab123cd456ef789gh'; my $triad = natatime 3, $s =~ m{ (\d) (\d) (\d) }xmsg; while (my @three = $triad->()) { print Dumper \@three; } " $VAR1 = [ '1', '2', '3' ]; $VAR1 = [ '4', '5', '6' ]; $VAR1 = [ '7', '8', '9' ];