#! /bin/perl -w use strict; my @a = qw ( server1 server2 server3 server5 ); my @b=(); my @c=(); open(FILE,"file") or die "$!\n"; @b=<FILE>; close FILE; chomp(@b); print "a list is @a\n"; print "b list is @b\n"; foreach my $server (@b) { if( ! grep(/$server/,@a)) { push(@c,$server); } } print "c list is @c\n";
In reply to Re: compare array with file
by Anonymous Monk
in thread compare array with file
by cinil
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |