#!/usr/bin/perl -w ######################################################### use strict; use Tie::File; my @fin=(); my @fout=(); tie @fin,"Tie::File","bigfile.txt" or die $!; my $fcount=1; for(my $ix=0;$ix<=$#fin;$ix+=30){ my $end = ( $ix+29 <=$#fin ? $ix+29 : $#fin ); my $outfilename = sprintf("litte_file_%0.2d.txt",$fcount); tie @fout,"Tie::File",$outfilename or die $!; for(my $iy=$ix;$iy<=$end;$iy++){ push @fout,$fin[$iy]; } untie @fout; $fcount++; }