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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|