
Iterator::Array::Jagged - Iterate through multiple jagged arrays

use Iterator::Array::Jagged;
# Build up a set of data:
my @data = ();
for my $var ( 1...3 )
{
my @set = ();
for my $val ( 1...2 )
{
push @set, "var_$var=val_$val";
}# end for()
push @data, \@set;
}# end for()
my $iterator = Iterator::Array::Jagged->new( data => \@data );
while( my @set = $iterator->next )
{
print "Next set: '" . join("&", @set) . "'\n";
}# end while()
The above code prints the following:
Next set: 'var1=val1&var2=val1&var3=val1'
Next set: 'var1=val2&var2=val1&var3=val1'
Next set: 'var1=val1&var2=val2&var3=val1'
Next set: 'var1=val2&var2=val2&var3=val1'
Next set: 'var1=val1&var2=val1&var3=val2'
Next set: 'var1=val2&var2=val1&var3=val2'
Next set: 'var1=val1&var2=val2&var3=val2'
Next set: 'var1=val2&var2=val2&var3=val2'

Iterator::Array::Jagged can permute through sets of "jagged" arrays - arrays of varying lengths.
Iterator::Array::Jagged works much like the odometer in an automobile. Except that each set of "numbers" can have any kind of data you want, and each set can contain 1 or more elements.

Constructor. %args should included the element data which contains the arrayref of arrayrefs that you wish to iterate through.
Returns an array representing the next iteration of the permutation of your data set. See the synopsis for an example.

It's possible that some bugs have found their way into this release.
Use RT http://rt.cpan.org/NoAuth/Bugs.html?Dist=Iterator-Array-Jagged to submit bug reports.

John Drago mailto:jdrago_999@yahoo.com

Copyright 2007 John Drago, All rights reserved.
This software is free software. It may be used and distributed under the same terms as Perl itself.