Perl: Dealing with "Can't use string XX as an ARRAY ref while "strict refs"" warning
perl
Solution
The items of `@$test_case_list` are hash references, whose keys are `label` and `expected`. The values for both keys are scalars (that are not array references). So you can't and/or shouldn't treat them as array references. But this is what you do if you use `@{...}` on them (such as in `@{ $test_case_item->{label} }`). Since they are already the scalars with the value you want, you should just go with `$test_case_item->{label}` instead.
Problem
I have ``` my $test_case_list = [ +{ label => &config->current->{'DBI'}[0], expected => 'dbi:mysql:dbname=investometrica', }, +{ label => &config->current->{'maintenance_file_path'}[0], expected => '/var/tmp/', }, ]; for my $test_case_item (@$test_case_list) { my $label = @{ $test_case_item->{label} }; my $expected = @{ $test_case_item->{expected} }; is ( $label, $expected, "Match"); } ``` This gives me an awful warning: Can't use string ("dbi:mysql:dbname=investometrica") as an ARRAY ref while "strict refs" in use at config.t line 25. What am I doing wrong?