It seems like I did not read enough of your message to give you a
sensible answer to your problem.

   # write a function to do what the one-liner did, but stopping at
the first row

   sub find_first {
         my $regex = shift;
         local @ARGV = @_;
         while (<>) {
              return $_ if /$regex/
         }
   }

   my $line = find_first(qr/<Test Case>/, 'temp.txt');
   my @fields = split /\s+/, $line;

Maybe that would help.

On 6/7/06, anu p <[EMAIL PROTECTED]> wrote:
Hi All,

I have a requirement where I need to check if a word
exists in a text file and if so, get the whole line of
text which contains the word. I also need to split the
line on space.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to