Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (1)
As of 2023-03-26 07:07 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (63 votes). Check out past polls.