in reply to [untitled node, ID 299588]

assuming that your simple format specs apply, eg. only one bracket set per line.
while($line=<>) { chomp $line; if (($part1,$part2)=~/(..*)\(..*\)(..*)/) { #now $part1 and $part2 scalars contain *things* before #and after the round brackets found in input print "Part1: $part1\n"; print "Part2: $part2\n"; } }