How can I pass a constant to a Perl subroutine?
-
20-09-2019 - |
Question
I have got as follows:
use constant ABC => ('one', 'two', 'three');
and I want to pass this constant to variations_with_repetition(\@data, $k)
subroutine as @data
.
How should I do that?
Solution
Use the []
operator to convert a list to an ARRAY reference:
variations_with_repetition( [ABC] , $k );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow