Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: doubt in storing a data of 2 lines in an array.

by Hofmator (Curate)
on Oct 30, 2006 at 13:57 UTC ( #581294=note: print w/ replies, xml ) Need Help??


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.

-- Hofmator

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.


Comment on Re: doubt in storing a data of 2 lines in an array.
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://581294]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2014-07-28 22:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (210 votes), past polls