Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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
Node Status?
node history
Node Type: note [id://581294]
[marinersk]: Corion This DBA wants to smack others who like putting whitespace in column names.
[marinersk]: s/smack/whap/;
[talexb]: Wow, what hilariously bad form.
[SuicideJunkie]: Just wait; someday soon, you'll be given a DB with unicode emojis in the column names.
[Corion]: marinersk: Well, I have done select statements like select sum(foo) as "Total Amount", ..., but to have a table like that makes me shudder
[Corion]: SuicideJunkie: :-D
[marinersk]: SuicideJunkie LOL
[choroba]: Woohoo! Fixed a test that hasn't run for 3 years.
[marinersk]: Corion Yes, sometimes whitespace in column headers is acceptable, but I still consider it be less than desireable if that query might get revectored for an ETL-esque process...
[marinersk]: choroba++

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2017-05-25 15:03 GMT
Find Nodes?
    Voting Booth?