The line foreach $host (<@allhosts>) is just wrong. The diamond operator is for reading from filehandles; it has nothing to do with iterating over an array. You wanted for my $host ( @allhosts ).
Having said that, a better approach would be to rethink what you're doing and go at the problem another way.
In reply to Re: matching a line from one file in another
by Fletch
in thread matching a line from one file in another
by New_to_this_stuff
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |