in reply to Re: Passing a reference to a subroutine in a constructor
in thread Passing a reference to a subroutine in a constructor

I get the same result when I do that. Is the execution of the sort method itself?
$self->{sorter}($keys);
Dr. Sax

Replies are listed 'Best First'.
Re3: Passing a reference to a subroutine in a constructor
by dragonchild (Archbishop) on Aug 22, 2003 at 20:11 UTC
    $self->{sorter}->($keys);

    Note the squigglies when de-referencing $self and the round parens when de-referencing the sort routine coderef.

    ------
    We are the carpenters and bricklayers of the Information Age.

    The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

      Rob,

      It's always a pleasure to see a guy whose sig line is longer than his response... ;-)

      Brian (a.k.a. DrSax)