in reply to Re: How to grep exact string
in thread How to grep exact string
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"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to grep exact string
by Kenosis (Priest) on Nov 15, 2012 at 22:14 UTC | |
|
Re^3: How to grep exact string
by ColonelPanic (Friar) on Nov 15, 2012 at 09:34 UTC | |
by tobyink (Canon) on Nov 15, 2012 at 10:13 UTC |