On Wednesday, April 3, 2002, at 02:33 , John W. Krahn wrote: [..] >> -----snap----- [..] >> Use of uninitialized value at /qmds/jbalint/20020128/datsample.pl line >> 47, >> <INFILE> chunk 478985. [..]
Good EYE!!! > How many elements does @random_numbers have? It looks like you are > trying to read past the end of the array. [..] hence it needs a my $MAX_RAND = @random_numbers; ..... while( <INFILE> ) { $file_pos++; my( $x ) = $random_numbers[$array_pos]; my( $y ) = $file_pos; if( $y == $x ) { $array_pos++; print OUTFILE $_; } # start recycling $array_pos $array_pos = 0 if( $array_pos >= $MAX_RAND); # # uncomment the die if you wish that instead # # die "input file greater than random numbers\n" # if( $array_pos >= $MAX_RAND); } ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]