#!/usr/bin/perl
use warnings;
use strict;
my $git_dir = "/tmp/yum_sorted.log";
open(DIR,$git_dir) or die "Really bad!$!";
my @yum =
;
my $hit; # <--- Inserted lines
foreach my $line ( @yum )
{
open(IN_GIT, "/tmp/git_sorted.log") or die "Really, really bad $!";
my @in_git = ;
foreach my $x ( @in_git ) {
if ( $line =~ $x ) {
print "We found a match: $line\n";
$hit = $line; # <--- Inserted lines
last; # <--- Inserted lines
}
}
if (defined $hit) { # <--- And final inserted conditional
# Do something
} else {
# Do something else
}