in reply to Re: Decompose a String into Tuples (Faster and Compact Way)
in thread Decompose a String into Tuples (Faster and Compact Way)

(Um, for the above to do what the op wants, I think you need something like  push @ret, "@_[$i..$i+2]"; instead of  push @ret, [$_[$i], $_[$i+1], $_[$i+2]];)

Here's my shifty suggestion:

sub decomp { @_ = split / /, shift; return [ map { join " ", (shift, shift, $_[0]) } (1..@_/2) ]; }
update: shorter and generalizable to producing any size tuple:
sub decomp { my $n = 2; # for n+1-uples @_ = split / /, shift; return [ map { $_*=$n; "@_[$_..$_+$n]" } 0..@_/$n-1 ]; }