There's no way other than multiplying individually each element by the constant.
You can write it more or less graciously, you can write a routine that does it changing the content of the array, there is also a Matrix module (but personally wouldn't even look at it for such a simple task), but that's it: no matrix manipulation instructions available with perl (as with almost all languages).
It depends on what you are defining as a matrix. If you mean something like an array of arrays, or a multi-dimensional array, there is plenty of perl documentation for that.
In addition to Ishids example, that changes the array elements, here is a way that does not:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.