I have a file with thousands of fields, but a subsequent program can only
had 3000.  I have to break this file up, for simplicity:

00001-03000
03001-06000

Hopefully, a basic outline of my code will suffice to get informative
advice.

my $cnt = -1 ;
my $subset = 1 ;

foreach ( 1..6000 ){

  $cnt++ ;

  if ( $cnt = 0 ) { 
    $my file = "File_" . $subset ;
    open CSV , ">" , "$file" ;
    print CSV "$_[ $_ ]" ;
  }
   else{
     print CSV ",$_[ $_ ]" ;
   }

  if ( $cnt == 3000 ){  
   close CSV ;
   $cnt = 0 ;
   $subset++ ;
  }

}  # cycled through all of the fields

After I print the mod( $_ , 3000 ) = 0 field to the file, I close that
filehandle and reset $cnt to zero.  I am not sure, but it seems that the
open function is not openning the subsequent filehandles. 
  
I would appreciate any corrections or suggestions.

Kind regards,

Kevin
  
Kevin Viel, PhD
Post-doctoral fellow
Department of Genetics
Southwest Foundation for Biomedical Research
San Antonio, TX 78227 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to