use strict; use warnings; use File::Slurp qw( slurp ); use Syntax::Keyword::Junction qw( any ); my @first = map { lc($_) } slurp('file1.txt'); my @second = map { lc($_) } slurp('file2.txt'); chomp(@first, @second); print "Machines extra in second list...\n"; for my $machine (@second) { if ($machine eq any(@first)) { print "$machine is already there\n"; } else { print "$machine is new\n"; } }