Submitted by harit on Tue, 12/19/2006 - 11:40.
( categories: perl questions )
Hi
I am trying to open a file using file handle,
Now I know a particular line saying expression X(not the line number),and now I want to search using this an want to format and save it into a variable.
How can i do that
Thanks in advance
+ Harit Himanshu

It's not very clear to me
It's not very clear to me what you're trying to accomplish:
do you want to store into a variable all the lines from a file that match a given regular expression?
If that is what you want you can do something like this:
my @results; while ( <FILE> ) { push @results, $_ if ( /regular-expression/ ); }