use Data::Heap::Whatever 1.1 ( \my $Heap, KeepTies => 1, CompactDump => 1 ); # ^^^^^^^^^ Factory object gets put into this lexical variable my $bestScores= $Heap->new( '>', -max => 10 ); my $worstScores= $Heap->new( '<', -max => 10 );