in reply to Joining an array

tangent:

The List::MoreUtils library has the function natatime that helps things like this. Example:

$ cat foo.pl use strict; use warnings; use List::MoreUtils qw(natatime); my @t = qw(name John number 7 status unknown); my @u; my $it = natatime 2, @t; while (my @vals = $it->()) { push @u, join("=",@vals); } print join("&",@u),"\n"; $ perl foo.pl name=John&number=7&status=unknown

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^2: Joining an array
by tangent (Parson) on Feb 11, 2012 at 00:48 UTC
    Thanks roboticus. I have seen that module mentioned a number of times, will look into it. I also remember spending many hours building an iterator a la Mark Jason Dominus in Higher Order Perl -- Chapter 4: Iterators. You have just shown me a use for my labour.