"Dharshana Eswaran" schreef: > i am trying to grep for a string in the file and once i get the > string, I need to read few lines which occurs before the string.
The classic (state machine) approach is to start storing strings from the start marker, so "typedef union" here, and discard the stored lines when the search string doesn't pop-up. Don't put the file in an array first. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/