my ($number) = $string =~ /(\d+)$/; ^ ^ ^^ | | || | | |+ - End of the string | | + - End capture | + - One or more digits + - Begin capture