if ($line[0] =~ /^c/) { # . . . my $unit = ($line =~ /\bunit=(\d*)/) ? $1 : ''; my $port = ($line =~ /\bport=(\d*)/) ? $1 : ''; # . . . }