in reply to doubt in storing a data of 2 lines in an array.
heidi, as in your last posts, your program is a bit confusing, your description and program do not really fit together, ...
A couple of pointers and maybe then you can clarify what you want to achieve
- Your program declares a @arr variable but never uses it. Please try to post the smallest code possible that exhibits your problem.
- You are saying that you are saving each line of the file in a separate array. That is not the case. You are overwriting scalar variables (like $entry or $title) each time you encounter a matching line. So e.g. at the end of your loop, you have the last ORGANISM line in the scalar variable $org.
- You are reading through your file line by line. How do you expect the 2nd line of a title to end up in the $title variable? None of your regular expressions match on this 2nd line so the else brach is executed and this line is pushed onto the array @se.
Code written by Hofmator and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
In Section Seekers of Perl Wisdom