in reply to How to implement closures in Package

You're calling "greet" as a method. Therefore it's getting passed the object ($obj) as its first parameter. But in the method you're assuming that the greeting is the first parameter. It's a simple fix.

sub greet { my($self, $grt) = @_ ; return sub { my($subject)= @_; print "$grt $subject \n"; }; }

Replies are listed 'Best First'.
Re^2: How to implement closures in Package
by perlCrazy (Monk) on Mar 13, 2007 at 11:08 UTC
    Thanks a lot :) It is working now