----- Original Message ----- From: "Prasanthi Tenneti" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>
> Hi, > Iam a beginner in perl.I have one question, > Iam trying to write one prog,in which i have to search for one word in a > file, > If I found that word,print next 4 lines. > PLs help me,how to write code. use strict; print "content-type: text/plain\n\n"; ### change this to open (FILE, ....... ######## my @array = ( 'hello' ,'world', 'mummy', 'where', 'are', 'you', 'mom'); my $count = ''; foreach my $record (@array) { $count++; if (grep {/mummy/i} $record){ print ("$record $array[$count] $array[$count+1] $array[$count+2]\n"); }; }; To members :- How to simplify this .... print ("$array[$count] $array[$count+1] $array[$count+2]\n"); _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]