#!/usr/bin/perl use strict; use warnings; my ($file1) = @ARGV; open(FILE, "<","$file1") or die "Can't Open File1\n"; my $pattern='^LOC'; my $pat='TAAAT'; while (my $line1 = <FILE>) { chomp($line1); #print "Line1:$line1\n"; if( $line1=~ /$pattern/) { while (my $line2 = <FILE>) { chomp($line2); #print "Line2:$line2\n"; if($line2 =~ /$pat/) { print "\nMatches: . $line1\n"; print "Matches: . $line2\n"; } else { print ""; } } } } close(FILE);
In reply to pattern and loop by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |