# Untested use strict; use Net::Telnet open(FH, "host_list_file") || die "Yikes $!"; while () { # your telnet stuff here }