in reply to Re: how to extract certain lines
in thread how to extract certain lines

Try this

while (<DATA>) { next unless /^HERE IS THE DATA/; my $line = <DATA>; print $line; } __DATA__ HERE IS THE DATA PLACED ABC; DO NOT ENTER PLACED BCD; HERE IS THE DATA PLACED ABC; WHO ARE U PLACED ABC; __OUTPUT__ PLACED ABC; PLACED ABC;

Neil

Replies are listed 'Best First'.
Re^3: how to extract certain lines
by dee00zee (Novice) on Oct 26, 2004 at 04:52 UTC
    Thank you Neil..
    I still have questions here.
    Why do you use my before $line
    what is the function of my here?
    Thank you
      Hi dee00zee,
      The my puts the variable into scope within the while loop.
      For information have a look at perldoc perlintro and the discussion on lexical scope.

      Neil

      my is used to declare and assign the variable $line. If you would 'use strict;' this is a requirement for the script to run.

      Manual for my: http://www.perl.com/doc/manual/html/pod/perlfunc/my.html

      Edit: Excuse me for this post, I somehow missed that the question was already answered.