in reply to matching every occurrence of a regex
$string =~ m/\s(\d+)\s/; $nposition = $1; [download]
If the sequences are in a file, you can just open the file and read through every line with a while loop. If you find a match, you can put it in an array.