my @t = split /,/, $_; #### ... my @z = 90005; ... ..elsif($t[6] eq "CA" && $t[7] eq !defined) { $worksheet->write($rowCount1+1, 7, $z[7]); ...