That means the you, the OP, probably aren't using use strict. If you had, elsif( $hostmatch == 1 ) would have resulted in an error unless you declared $hostmatch twice. Please use use strict; use warnings; and address any resulting errors and warnings.