don't rely on /usr/bin/perl
perl 5.18 sorts keys differently, so use sort to also get the same key order

althought this does not make any difference for the filter itself, it matters
for the test.
replace env with a global variable