use strict; use warnings; open my $numberFH, q{<}, \ < ); close $numberFH or die qq{close: $!\n}; my $rxFindTrans = do{ local $" = q{|}; qr{(@numbers)}; }; open my $transFH, q{<}, \ < blurfl 154876543 more rubbish the one we want 154216722 with more stuff blargh 54211548 EOD { local $/ = qq{\n}; while( <$transFH> ) { s{.*(?=)}{}s; next unless m{$rxFindTrans}; print qq{Found $1 in:\n$_}; print qq{==================\n}; } } close $transFH or die qq{close: $!\n}; #### Found 154216722 in: the one we want 154216722 with more stuff ==================