in reply to Re^2: Read text in file and assign to variable
in thread Read text in file and assign to variable

In addition to ++Athanasius' excellent reply, note the examples in my earlier response.

In the first, I put the match output into a list and assigned the 0th element:

$version = (<$fh> =~ /(\d)/)[0];

In the second, I used my ($version) = ..., as already explained.

— Ken