There's more than one way to do things | |
PerlMonks |
Re: Data extraction with specific keywordsby johngg (Canon) |
on Jan 19, 2018 at 11:58 UTC ( [id://1207513]=note: print w/replies, xml ) | Need Help?? |
When initialising your @arr1 array you could save a yourself a heap of fiddly and error-prone typing by using a map with the qw{ ... } quote words operator. E.g.
You might also make things easier for yourself (and any others maintaining your code) by using meaningful variable names rather than $c, $i or $j. It is not clear from your description and your code exactly what you are trying to achieve. The "few" lines of data you posted seem to be in two sections headed "0" and "1" each having many lines of data in the form:-
Please correct me if that is wrong. Your @arr1 appears to be a selection of the initial parts of the data lines in an apparently random order. Is this order to be preserved in your output file and do you want a separate output file for each section? Depending on the answers to these questions you might be better off using hashes rather than arrays. Cheers, JohnGG
In Section
Seekers of Perl Wisdom
|
|