Hello, I have been getting an error in my code for a reason that I cannot
understand. The code looks like this:
-----snip-----
$\ = ":";
foreach( @random_numbers ) { print; }
open( INFILE, $opt_i ) or die( "Cannot open $opt_i: $!" );
open( OUTFILE, "> $opt_o" ) or die( "Cannot open $opt_o: $!" );
my( $file_pos ) = 0;
my( $array_pos ) = 0;
while( <INFILE> ) {
$file_pos++;
my( $x ) = $random_numbers[$array_pos];
my( $y ) = $file_pos;
if( $y == $x ) {
$array_pos++;
print OUTFILE $_;
}
}
-----snap-----
The errors are as follows. I know the random_numbers array is filled because
the code prints out the whole array. The x and y variables were stuck in
there to see if it would work. It originally said if(
$random_numbers[$array_pos] == $file_pos ) but that wouldn't work either.
Any ideas? Thanks. P.S. This is perl version 5.005_03
Use of uninitialized value at /qmds/jbalint/20020128/datsample.pl line 47,
<INFILE> chunk 478985.
Use of uninitialized value at /qmds/jbalint/20020128/datsample.pl line 47,
<INFILE> chunk 478986.
Use of uninitialized value at /qmds/jbalint/20020128/datsample.pl line 47,
<INFILE> chunk 478987.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]