$string = 'Total requests:,20,30,40,50,60' #the list could go on if ($string =~ m/Total requests:,*?(\d+),(\d+),(\d+),(\d+)/) #don't know how to do this if to grep all the numbers in that line