in reply to Regex extracting a number from numbers and text

Very close. You are right to use \b. The problem is that you also used ^ which means "start of string". The number is not located at the start of the string.
$text =~ /\b(\d+)/

Update: By the way, you shouldn't use $1 unless you made sure the match succeeded.

if ($text =~ /\b(\d+)\b/) { print("Matched $1\n"); }

Update: Other solutions:

# The first standalone number. $text =~ /\b(\d+)\b/
# By context. $text =~ /(\d+) months? old/
# The last number. $text =~ /^.*\b(\d+)/