in reply to randomly selecting files
#! /usr/bin/perl # use strict; use warnings; use Math::Combinatorics; my @files; push @files, "file$_" foreach (1..36); my $c = Math::Combinatorics->new( count => 3, data => \@files); while (my @combo = $c->next_combination()) { my %combins; @combins{@combo}=(); my @leftovers = grep {!exists($combins{$_})} @files; print "Choose: @combo\tLeave: @leftovers\n";}
update: Obviously you would populate the @files array using a glob or similar. If your files aren't large you could pre-read them into memory.
|
|---|