in reply to regex help
$imgNumber =~ /^(\d{6})(.*)\.jpg$/
This saves the six digits in $1 and the optional text in $2 (excluding the extension).