That is Perl code so the first error message is meaningful.
With delimiters other than //
in the match operator you must have the explicit m
for it, so
$output_volume =~ m?^([\S]+).mnc?
It is only with //
delimiters that the m
may be omitted; from Regex Quote-Like Operators (perlop)
If
"/"
is the delimiter then the initialm
is optional.
See perlretut for a tutorial introduction to regex and perlre for reference.
Also note that the particular delimiters of ?
trigger specific regex behavior in a special case. This is discussed by the end of the documentation section in perlop
linked above.