use List::Util qw(shuffle); use strict; my $file = $ARGV[0]; open (VCF,$file); my @array=; #read file into array my @newvcf; for (my $i=0; $i<1000000; ++$i) { #giving script plenty of room to work... my $randomline=$array[rand @array]; #randomize lines of file if (scalar @newvcf<2) { push (@newvcf, $randomline); #build new array/subset of lines } }