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?
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?
Use the [] operator to convert a list to an ARRAY reference:
variations_with_repetition( [ABC] , $k );
You can try this:
use strict;
use warnings;
use constant ABC => ('one', 'two', 'three');
sub foo {
my $list = shift;
die if ( $list->[0] ne 'one' );
die if ( $list->[1] ne 'two' );
die if ( $list->[2] ne 'three');
}
my @data = ABC;
foo \@data;