in reply to writing to arrays

while (<FILE>){
chomp;
next if $_ =~/\>DATA SET/;
push @array,$_;
}

Everyone seems to be making this more complicated than it
needs to be.

Superman
Make sure you qualify your data if possible.
Cheching string length may be one option
Its always good to check incomming data you may not have control of.

Replies are listed 'Best First'.
Re: Re: writing to arrays
by BrowserUk (Patriarch) on Dec 26, 2002 at 10:42 UTC

    All this code does is push the whole file into a single array haveing removed every line that contains the text ">DATA SET". Your code does not even ensure that this is found at the start of the line.

    What you end up with is an array of everything munged together, all grouping information lost with no way to recover it.

    It's hard to believe that this will meet the OP's requirements.


    Examine what is said, not who speaks.

      Yep, I know. I did not realize he/she needed seperate arrays
      for each dataset. Realized after posting, Please ignore
      previous post.

      sorry- hand officially slaped