anu p wrote:
> Hi All,

Hello,

> 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.

@row_val = map split, grep /<Test Case>/, @table;



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to