Reputation: 51
use warnings;
use strict;
testfunc();
sub testfunc {
my @first_pin_name_list=qw(
VDD2_DDR2_S2_4
VDD1_DDR2_S2_2
);
my @second_pin_name_list=qw(
VDD2_DDR2_S2_4
VDD1_DDR2_S2_2
);
my @expected_list =qw(
VDD1_DDR0_S2_[2:1]
VDD2_DDR0_S2_[5:1]
);
my @listoftests = (
{INPUT_LIST => \@first_pin_name_list,OUTPUT_LIST => \@expected_list,OK_2_FAIL=> 0},
{INPUT_LIST => \@second_pin_name_list,OUTPUT_LIST => \@expected_list,OK_2_FAIL => 1}
);
print @expected_list;
# should show an array but instead debugger shows an array of an array
my @listtotest = $listoftests[0] -> {INPUT_LIST};
print "hello";
return @listoftests;
}
The debugger shows @listtotest
containing an array of an array, but I want to see just an array with elements. How can I change my code to show just an array of elements?
Upvotes: 2
Views: 76
Reputation: 98388
You aren't showing us what the debugger is showing you, but there is no array of arrays.
$listoftests[0]->{INPUT_LIST}
is a reference to an array, @first_pin_name_list.
If you want to assign the elements in that array to @listtotest
, you need to dereference it:
my @listtotest = $listoftests[0]->{INPUT_LIST}->@*;
or on older perls:
my @listtotest = @{ $listoftests[0]->{INPUT_LIST} };
Upvotes: 6