0

I have a hash saved in $target_parser_list

In the debugger this is what I have

   DB<3> x  $target_parser_list
0  HASH(0xd570d28)
   'ASCE::ASCE' => undef
   'Bulk::BULK' => undef
   'Bulk::BULKdoi' => undef
   'CQ::Researcher' => undef
   'Highwire::OUP' => undef
   'Highwire::highwire' => undef
   'INFORMIT::INFORMIT' => undef

but then when I try to iterate over it

foreach my $key(keys %target_parser_list ){
    print $key;

}

I get the error that

Global symbol "%target_parser_list" requires explicit package name

When I try to change it to

foreach my $key(keys $target_parser_list ){

Then I get an error saying that I need a hash,

Type of arg 1 to keys must be hash (not private variable

If I change the $target_parset_list variable to hash

my %target_parser_list =  $target_parser_list_conf->getSection('target_parser') || '';

Then the output is

DB<2> x  %target_parser_list
0  'HASH(0xc758888)'
1  undef

and when I print my key it's

DB<3> x $key
0  'HASH(0xd5353d0)'

Please show me how to iterate over my keys like you see in the beggining.

melpomene
  • 84,125
  • 8
  • 85
  • 148
yankel
  • 135
  • 9

0 Answers0