#!/usr/bin/perl use warnings; use strict; open (IPS, "ips.txt") or die "could not open file ips.txt: $!\n"; foreach my $ip () { system("iptables -A INPUT -p tcp $ip -j DROP"); } close IPS or die "could not close file ips.txt: $!\n";