bless { @_ }, $class; #### my %hash = @_; bless(\%hash, $selfObjRef); #### bless({@_[1..$#_]}, $_[0]); #### my %phrases = ( "phrase 1" => Qty->new( qty => 1, qtySum => 5, qtyCont => 8 ), "phrase 2" => Qty->new( qty =>10, qtyCont =>34 ), "phrase 3" => Qty->new( qty =>1 ) ); #### print $phrases{'phrase 2'}->{'qtySum'}; print $phrases{'phrase 1'}->{'qtyCont'}; print $phrases{'phrase 3'}->{'qty'}; #### my %phrases = ( 'phrase 1'=>{ qty=>1, qtySum=>5, qtyCont=>8, qtyTotal=>sub{return &qtyTotal('phrase 1', @_);} }, 'phrase 2'=>{ qty=>10, qtyCont=>34, qtyTotal=>sub{return &qtyTotal('phrase 2', @_);} }, 'phrase 3'=>{ qty=>1, qtyTotal=>sub{return &qtyTotal('phrase 3', @_);} } );