sub set_stock { my( $self, $supplier, $line, $stockLevel ) = @_; my $supplierList = (); my $supplierNumber = $supplier->supplier_id; # $supplierList will be a reference to a hash of references to hashes. unless( $supplierList = $self->get('supplier_list') ) { die( "Cannot set stock level when supplier list is corrupt: $supplierList" ); } my $reference = $line->reference; $supp->{ $supplierNumber }{ $reference } = $stockLevel; }