for(@PORTS){ ($KEY,$VAL)=split(/:/); $HOST=$VAL if $KEY =~ /Host/; $CONNTIME=$VAL if $KEY =~ /Connection time/; $CONNEDHOST=$VAL if $KEY =~ /Connected host/; ...