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.
Example: <Test Case> 1 1 0 0 P 6/6 - Code: open (FIN, "temp.txt") || die "Cannot open file for read $!\n"; @table = <FIN>; close(FIN); @row_val = grep (/<Test Case>/, @table); This works fine but I cannot the split the values in @row_val since the whole line is taken as one element of array. So, I'm using another approach now which works fine but I think it might not be very efficient Code: open (FIN, "temp.txt") || die "Cannot open file for read $!\n"; while (<FIN>) { if (/<Test Case/) { $row = $_; @row_val = split(/s+/, $row); .... } } Can someone suggest a better method of performing the search. Thanks, Anu. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>