http://www.perlmonks.org?node_id=654303


in reply to Perl Riddle

%ENGINES seems to be empty because the each iterator isn't reset when you call list_engines, causing it to iterate only on the remaining items that weren't yet treated by set_engines' each. You can reset the each iterator by putting scalar keys %ENGINES at the beginning of list_engines.