$lines = 56; $filename = 'chapterx.html'; $nameformat = 'chapterx_page_%d.html'; open(INFILE, "<$filename") or die $!; while(<INFILE>) { if ($. % $lines == 1) { open(OUTFILE, '>'.sprintf($nameformat, $. / $lines + 1)) or di +e $!; } print OUTFILE $_; }
In reply to Re: How do I split a file by lines into smaller files
by swr
in thread How do I split a file by lines into smaller files
by PatrioticDreamer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |