as an array? First, run open(FH, "wc -l filename |") and grab the line count. Then read 8.6, 8.7, 8.8 from the Cookbook. Instead of reading all the
into an array, fill the array with its index and shuffle it (4.17 in the Perl Cookbook). Then, read to each line number then reset. You only need to open the old file once, just reset its pointer using $. = 0 and loop through the array of line numbers.