if ($totalmass != 0){@wtPercent = map{$_ / $totalmass}@wtPureAmt}else{$statustext = "You need to give me numbers!"}; #### if ($totalmass != 0){ foreach (0 .. $#wtPercent) { $wtPercent[$_] = ($wtPureAmt[$_] / $totalmass); } } else { $statustext = "You need to give me numbers!" };