my ( $val1, $val2 ) = m/\A # beginning of line (\d+) # some numbers (capture) \+ # the plus sign \d+ # more numbers (don't capture) \, # the comma (escaped) ([0-9\.]+) # the second number \z # end of line /smx;