Assuming that your data file always begins with a matching pattern on the first line as in the sample data you provided, the following would work.
use strict; use warnings; while(<DATA>){ if(/DN:$/){ chomp(my $filename = <DATA>); open FH, '>', $filename or die; } else { print FH $_; } }
In reply to Re: Split file
by arun_kom
in thread Split file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |