sub norm{ $p=$#data; #I call the 100k x 3 array @data for($i=0;$i<=$p; $i++){ # iterates down @data $norm=(($data[$i][0])**2+($data[$i][1])**2)**(1/2); #calculates the norm push(@data[i],$norm); #pushes the norm into the correct row of @data, yet I get an error. } }