Next Higher-Order Perl 122 

Anonymous Subroutines as Objects

        sub new {
          my ($package, $name, $balance) = @_;
          my $self = { NAME => $name, BALANCE => $balance };
          bless $self => $package;
        }
        ...
        my $object = BankAccount->new('Fred', 100.00);
        $object->{BALANCE} = 1000000000000.37;

Next Copyright © 2006 M. J. Dominus