in reply to what on earth is going on?

So, one file might not have columns 1 3 and 6

What does that mean? ITYM you want to output a file missing any three columns.

(Incidentally i wonder why you want to do that for all combinations of three columns.)

I want to create files for all combinations of 10 columns .. making 120 files in total.
How strange!! Especially since Choose(13,10)=Choose(13,3)=286. Whatever, I would go for some combinatorial module and then slicing.

Replies are listed 'Best First'.
Re^2: what on earth is going on?
by inman (Curate) on Nov 10, 2005 at 17:45 UTC
    This code uses Math::Combinatorics to work out the combinations. It is easier to work out the combinations that you want to keep rather than those that you want to get rid of.

    use Math::Combinatorics; my @cols = (0..12); my @combin; my @data = ('A'..'Z'); my $combinations = Math::Combinatorics->new(count => 10, data => [@col +s]); while (@combin = $combinations->next_combination()) { print join("\t", @data[@combin]), "\n"; }