New_to_this_stuff has asked for the wisdom of the Perl Monks concerning the following question:
$infile="hosts.txt"; open(INPUT, $infile) || die "Error opening $infile\n"; my @allhosts = <INPUT>; foreach $approvhost (<STDIN>) { foreach $host (<@allhosts>) { if ($host =~ m/^$approvhost/) { print $host; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: matching a line from one file in another
by Fletch (Bishop) on Apr 14, 2006 at 14:42 UTC | |
by New_to_this_stuff (Initiate) on Apr 14, 2006 at 17:02 UTC | |
|
Re: matching a line from one file in another
by davidrw (Prior) on Apr 14, 2006 at 14:54 UTC | |
by Thelonius (Priest) on Apr 14, 2006 at 19:06 UTC | |
|
Re: matching a line from one file in another
by Herkum (Parson) on Apr 14, 2006 at 14:38 UTC | |
by New_to_this_stuff (Initiate) on Apr 14, 2006 at 17:00 UTC | |
|
Re: matching a line from one file in another
by davido (Cardinal) on Apr 14, 2006 at 15:54 UTC | |
|
Re: matching a line from one file in another
by cormanaz (Deacon) on Apr 15, 2006 at 00:20 UTC |