The behaviour of smart match on arrays may well change in Perl 5.18 or 5.20.
This works quite nicely for me...
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"; } }
In reply to Re^2: How to grep exact string
by tobyink
in thread How to grep exact string
by Divakar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |