in reply to Parsing chapter id's

I think that the key is matching everything up to the last period:
if ($chapter =~ /^([\d.]+\.)\d+$/) { print "$1 is prior to $chapter.\n"; }