#! /usr/bin/perl open(FILE,"; close(FILE); my $module; my $id; foreach my $line(@lines) { chomp($line); if($line=~ /Module.*/) { $line=~ /:\s*/;$module=$'; } if($line=~ /ID.*/) { $line=~ /:\s*/;$id=$'; } if($line=~ /Customer : yes/i) { print "$module and $id\n"; } }