Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^2: appending a variableby Marshall (Canon) |
on Apr 28, 2022 at 20:17 UTC ( [id://11143400]=note: print w/replies, xml ) | Need Help?? |
Yes, braces are one way to disambiguate where the variable name ends. Often I will use the concatenate operator to avoid the need for braces. This probably runs slower, but you can space out the var names to be substituted in order to make them more obvious (YMMV).
Also, OP probably meant: my ($opstr) = $vmstr =~ /-(\d+)$/; in the case of one digit (e.g. 0)?
In Section
Seekers of Perl Wisdom
|
|