Hope you have a file which contains these lines,

Just check below code :

$File = "sample.txt";

open(IN,"<$File");

while(<IN>)
{
     $_ =~ s/\x0d//g;

     if( $_ =~ m/play/i )
     {
          $Result = "";
          while( $_ =~ /.{0,5}play.{0,5}/i  )
          {
               $Result .= $`;
               $Temp = $&;
               $_ = $';

               print $Temp."\n";

               $Result .= $Temp;
          }
          $Result .= $_;
          $_ = $Result;
     }
}
close(IN);

bye
aravind
System Executive
eFunds International India Pvt. Ltd.
8272628, Ext. 4593


> > 1. What should I do , if I want to read each line
> of
> > text with the "search word". Should I put the
> > occurence of search word in an array ? (I'm not so
> > sure).

> > 2. If I want to read the string, provided only a
> > certain length (for e.g., 5 words to the LEFT of
> > "search word" & 5 words to the RIGHT of "search
> > word"). Is there a range to declare but how to
> detect
> > the starting point and end point for each
> occurence?
>


********************************************
This  electronic  mail  message is intended solely for the named recipients
and may contain confidential and proprietary business information of eFunds
Corporation  and  all its subsidiaries.   If you are not a named recipient,
please notify the sender immediately.  You may not disclose the contents to
any  other person; use this electronic mail message or its contents for any
other purpose; or further store or copy its contents in any medium.
********************************************


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to