cinil has asked for the wisdom of the Perl Monks concerning the following question:
Hi All,
I'm a newbie and need help in compare one array with a file. I'm expecting a list which is not present on array. The output I'm expecting is server7 and server8, which I'm not getting now.
@a = qw ( server1 server2 server3 server5 ); open FILE , "file"; @b = <FILE>; close FILE; @c = grep!${{map {$_ ,1}@a}}{$_},@b; print "@c";
reading the file.
$cat file server2 server5 server7 server8
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: compare array with file
by trizen (Hermit) on Apr 24, 2012 at 12:27 UTC | |
|
Re: compare array with file
by BillKSmith (Monsignor) on Apr 24, 2012 at 13:19 UTC | |
|
Re: compare array with file
by Anonymous Monk on Apr 24, 2012 at 12:20 UTC | |
by cinil (Initiate) on Apr 30, 2012 at 12:27 UTC | |
|
Re: compare array with file
by j1n3l0 (Friar) on Apr 24, 2012 at 16:58 UTC | |
|
Re: compare array with file
by brx (Pilgrim) on Apr 24, 2012 at 13:46 UTC | |
|
Re: compare array with file
by Anonymous Monk on Apr 25, 2012 at 10:43 UTC | |
by Divakar (Sexton) on Apr 25, 2012 at 10:45 UTC |