INPUT SEQUENCE=XXX #### ______________________________________________________________________ +___________________________________ #### #!/usr/bin/perl use strict; use warnings; use Tie::File; my ($file,$recs_X_file) = @ARGV; die "Usage: $0 " if (@ARGV != 2); tie my @arr, 'Tie::File', $file, recsep => "_________________________________________________________________________________________________________",autochomp=>0; my $from=0; my $to=$recs_X_file-1; while ($from < $#arr){ my $ofile = "file.$from-$to"; open F,">",$ofile or die $!; print "printing records $from to $to in $ofile\n"; print F @arr[$from..$to]; $from=$to+1; $to = $from+$recs_X_file-1; } #### perl split_records.pl inputfile 10 #### printing records 0 to 9 in file.0-9 printing records 10 to 19 in file.10-19 printing records 20 to 29 in file.20-29 ... and so on (depending on the number of records of the original file