Hi All, I need to searh through a text file and lookfor a keyword and print the immediate word following it and before it. for eg.,
$_="bird was eating fish"; output for keyword eating shd be: was eating fish this is what i am doing, $key="dog"; @sspace=`cat file.txt`; foreach(@sspace) { / (.*) $key \w/; print "$1"; print "$2\n"; } this doesnt work and prints the entire line...how do i get it to wordwise ? thanks Mandar -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>