in reply to Re: Getting rid of "new" (wrong target; perl6)
in thread Getting rid of "new"

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 );
$Heap is scoped to the implicit BEGIN block.

Replies are listed 'Best First'.
Re^3: Getting rid of "new" (wrong target; perl6)
by tye (Sage) on Jul 11, 2006 at 12:59 UTC

    Thanks. Drat, I thought I'd used that before. So you need to declare the variable outside of the use statement (which is clearer and how I'd normally write such code anyway).

    - tye