in reply to Re: Re: which data structure and how?
in thread which data structure and how?

You are not using -w or strict. In particular, there is nothing in $row, because it's only used once. $row[0] would be a more likely choice.

Let Perl help you debug.

Update: Additionally, @fields is not defined, as far as I can see. Even if your if loop executed, you'd be throwing away the data you just read in. This is *exactly* the time to use strict and -w! If the error messages confuse you, use diagnostics as well. Perl will tell you when you throw away your data and that is most of your problem here. The other part is not setting $/ to "\n;\n".

  • Comment on Re: Re: Re: which data structure and how?

Replies are listed 'Best First'.
Re: Re: Re: Re: which data structure and how?
by malaga (Pilgrim) on Mar 31, 2001 at 06:54 UTC
    I tried that before, still nothing. I took it out just to see if I would get something back. I'm not using strict or -w only because i'm testing. i will once i get something usable. i'm not online with it. My ->ref{} can be any word at the beginning of a line in my file, and it should give me that same line back, right? is there a better way to do this? when i read in the file, i need the records in between the ";"s or between each "Beginning" and "End" to be separate records.
      Question.

      You are not using strict and -w while testing to catch your little errors and speed development. But you then think it is fine to ask the entire Monastery to track down your mistakes?

      What is wrong with this picture?

      Telling people to use warnings and strict is like handing someone a fishing pole. It will catch a lot of your mistakes, and will prevent a lot of silly little questions that simple bugs tend to leave people with. I don't mind telling 15 people per day who don't know they need that wheel that they need it. I strongly mind dealing with one a week who knows it is there, and should know that it would prevent them from having a question to ask, but just couldn't be bothered to use it. That one makes me wonder whether I am wasting my time on the 15...

      Please, if only for my sanity, stare at what chromatic told you, use strict, and try again. You already have a good answer. Use it and become a little more self-sufficient...