my @fields = $line =~ $long_regex; if (@fields == 10) { # process $fields[0] .. $fields[9] here }