in reply to Re^2: skip lines
in thread skip lines

My example code doesn't use @input at all. But if you push $_ onto @input instead of printing it, you should get the desired result. (Note: start off with an empty @input array).
Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^4: skip lines
by halligalli (Novice) on Jul 20, 2010 at 14:31 UTC
    thanks but its not working, i dont see the mistake in the code....
    my $in_header = 1; while (<@data>) { if (/Parameter/) { $in_header = 0; next; } next if $in_header; push(@data,$_); } print @data, "\n";
    i dont understand why to use "if...." because "Parameter" is always the first Value and always in my dataset...
      Your code doesn't do the same as mine does. It doesn't read from the file in the header of the while-loop, for instance.

      You also ignored what I wrote:

      (Note: start off with an empty @input array).

      So I suggest that you try to actually understand what originally posted code does, and then modify it to fit your needs. Don't try to mindlessly fit in the frame of the code you posted before.

      Perl 6 - links to (nearly) everything that is Perl 6.
      i dont see the mistake in the code....

      Here's one:

      while (<@data>) {

      The angle braces either perform readline or glob, neither of which you want here. You appear to intend to write:

      while (@data)

      ... but that's not going to work very well because the last line of the block is:

         push(@data,$_);

      ... so you'd create an infinite loop.

      Iterate over the filehandle instead of @data and you'll have more success.