$\ = 1; while(<>) { chomp; $a = 16 - s/,//g - 1; if ($_ eq "NONE") { $a = 16; } $\ *= $a * $a; } print;