in reply to returning nested data structures

Try returning a reference to the hash:
return \%filters;
Other things to do:
  • Begin your code with:
    use strict;
  • Initialize filters:
    my %filters=();
  • Add some print statements.
  • Dump %filters prior to returning it just to check:
    use Data Dumper; print Dumper(\%filters);