Hi, Mazhar <[EMAIL PROTECTED]> asked: > Open (FILE1,">one Fuile"); > Open (FILE,">Second File");
Please post working examples, not pseudo code. > while (<FILE1>) > { > $line1 = $_; This is bad. I'd suggest you use meaningful variable names. They help people to understand what you're trying to code: while( my $pattern = <FILE1> ){ chomp( $pattern ); # remove trailing EOL > while (<FILE>) > { > $line = $_; while( my $line = <FILE> ){ > if ($line =~ /(.*)$line1(.*)/) print "matched '$pattern' on line $." if $line =~ m/(.*?)$pattern(.*)/; } Also, you need (.*?) and (.*) only if you're interested in the part of the matched line that goes before and after the pattern. Otherwise, just say m/$pattern/. HTH, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>