One way would be to print each line to a different file and loop through the input file:
open(INFILE,"my.log") || die "Couldn't open my.log!\n"; open(FILE1,">file1") || die "Couldn't open file1!\n"; open(FILE2,">file2") || die "Couldn't open file2!\n"; open(FILE3,">file3") || die "Couldn't open file3!\n"; open(FILE4,">file4") || die "Couldn't open file4!\n"; my $count = 1; while(<INFILE>){ print FILE1 $_; $_ = <INFILE> || last; print FILE2 $_; $_ = <INFILE> || last; print FILE3 $_; $_ = <INFILE> || last; print FILE4 $_; } Another alternative would be to use sysread to break up the file into equal parts, but it would be difficult to break it up by lines. I'm not the expert at sysread, or I'd give you an example. -----Original Message----- From: Johnny Hall To: PERL Beginners Sent: 11/4/02 9:31 AM Subject: Split a file Hello all, I am trying to take a file of variable length on a daily basis and divide it up into 4 equal parts for processing on each file. Does someone have an easy way to do this? The original file is just a series of numbers like.. 3233404936 3233404934 3233669122 3233557761 3233818369 3234343425 3233431553 3233455617 3233404932 3233435393 3233562369 3233554689 ..... I've tried everything I know. Granted, that isn't very much. :-) Here is what I'm doing so far.. Thanks, Johnny Hall <<clone_ux.pl.dev>> <<ATT52016.txt>> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]