|
|
| Do you know where your variables are? | |
| PerlMonks |
Re: how to split file with some patternby blindluke (Hermit) |
| on Jan 23, 2015 at 08:21 UTC ( [id://1114243]=note: print w/replies, xml ) | Need Help?? |
|
It's a shame that you did not tell us what you already have tried, and what went wrong with your attempt. You are also missing some important information: how are the output files supposed to look? Should they contain the delimiter lines? Or should they contain everything, including module and endmodule? Since the text blocks seem not to contain any blank lines, here is a very lazy way to solve the problem you are having.
This solution uses the "paragraph mode" - this line: $/ = ""; makes sure that the iterating over the contents of the file is done not by line, as it usually is, but by whole paragraphs. If you uncomment the Data::Dumper line, you will see that the data from your input file is parsed into an array of hash references, in a way that gives you the information about the contents of the output file and its name. Good luck with your problem. - Luke
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||