The formatting of the code/data and intent was hard for me to understand. But maybe this works for you?:
#!/usr/bin/perl -w use strict; use Data::Dumper; # a core utility use List::Util qw(shuffle); # a core utility my @data; while (<DATA>) { next if /^\s*$/; #skip blank lines my ($important) = (split(' ',$_))[0]; push @data, $important; } print Dumper \@data; #debug - just to verify the split() # so @data is about 100,000 entries # this is a big array, but not that big # the use of splice() works, but is relatively inefficient # perhaps just use List::Util shuffle to randomize the # indicies? # This will create a list with 100,000 values # but it will do it efficiently. # Within the parameters of what you have said, # 1/4 million array/list elements will work ok, even on # my wimpy Win XP32 bit machine foreach my $index (shuffle (0..@data-1)) { print "$index $data[$index]\n"; } =prints VAR1 = [ 'FRZPY5Q02F00L9.ICM_AWP_Bv6.AWP_0001_2007_08_23', 'FRZPY5Q02F00U8.ICM_AWP_Bv6.AWP_0001_2007_08_23', 'FRZPY5Q02F01NC.ICM_AWP_Bv6.AWP_0001_2007_08_23', 'FRZPY5Q02F023C.ICM_AWP_Bv6.AWP_0001_2007_08_23' ]; 3 FRZPY5Q02F023C.ICM_AWP_Bv6.AWP_0001_2007_08_23 2 FRZPY5Q02F01NC.ICM_AWP_Bv6.AWP_0001_2007_08_23 1 FRZPY5Q02F00U8.ICM_AWP_Bv6.AWP_0001_2007_08_23 0 FRZPY5Q02F00L9.ICM_AWP_Bv6.AWP_0001_2007_08_23 =cut __DATA__ FRZPY5Q02F00L9.ICM_AWP_Bv6.AWP_0001_2007_08_23 ACTGCCAACGCGCAGAACCTTAC +CAGGTCCTGACTTCCTGACTATGGTTATTAGAAATAA TTTCCTTCAGTTCGGCTGGGTCAGTGACAGG +TGATGCATGGCCGTC FRZPY5Q02F00U8.ICM_AWP_Bv6.AWP_0001_2007_08_23 ACTGCCTAACCGATGAACCTTAC +CTACACTTGACATGCAGAGAACTTTCCAGAGATGGAT TGGTGCCTTCGGGAACTCTGACACAGGTGAT +GCATCGCCGTC FRZPY5Q02F01NC.ICM_AWP_Bv6.AWP_0001_2007_08_23 ACTGCCTACGCGAAGAACCTTAC +CTACACTTGACATACAGAGAACTTACCAGAGATGGTT TGGTGCCTTCGGGAACTCTGATACAGGTGAT +GCATGGCTGTC FRZPY5Q02F023C.ICM_AWP_Bv6.AWP_0001_2007_08_23 ACTGCCAACGCGCAGAACCTTAC +CAACCCTTGACATCCAGAGAATTTTCTAGAGATAGAT TTGTGCCTTCGGGAACTCTGTGACAGGTGAT +GCATGGCTGTC

In reply to Re: Get random unique lines from file by Marshall
in thread Get random unique lines from file by radnorr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.