use strict; use warnings; open my $fh, '<', 'hosts' or die; my @hosts = <$fh>; close $fh; my @new_hosts = grep { !/$ARGV[0]/ } @hosts; print "\nnew_hosts:\n"; print join "", @new_hosts;