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
In reply to Re^3: Read text in file and assign to variable
by kcott
in thread Read text in file and assign to variable
by maxamillionk
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |