in reply to Trying to read numbers from a text file

One way is to remove the parentheses before splitting. Here I replace all parens with a single space just in case your input ever has adjacent closing/opening parens, like (1 2 3)(4 5 6):
use warnings; #use strict; while (<DATA>) { chomp; tr/()/ /; @words = split; } $L=($words[2]+$words[5]); $D=($words[1]+$words[4]); $M=($words[3]+$words[6]); print "L=$L D=$D M=$M\n"; # Output: L=37 D=21 M=5 __DATA__ 25 ((18 25 4) (3 12 1))