in reply to Why won't a hash in a hash work as a hash reference to create an object?
sub new { my ($account) = @_;
That's the problem. The first argument that new gets is the name of the class. So instead write
sub new { my ($class, $account) = @_; return bless $accounts{$account}, $class; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why won't a hash in a hash work as a hash reference to create an object?
by Lady_Aleena (Priest) on Apr 07, 2012 at 21:22 UTC | |
by chromatic (Archbishop) on Apr 07, 2012 at 21:36 UTC | |
by moritz (Cardinal) on Apr 08, 2012 at 05:43 UTC |