in reply to it seems i don't understand =~

Even your supposedly working version doesn't work. The match needs to be in list context (as created by the parens below) for the the match operator returns a list of the captured values.

=~ is used to specify what value the match operator operates on. It doesn't affect the returned value.

($value) = $value =~ /(\d+)/;