Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re4: Database storage confusion

by blakem (Monsignor)
on Mar 09, 2003 at 05:57 UTC ( #241506=note: print w/replies, xml ) Need Help??

in reply to Re^3: Database storage confusion
in thread Database storage confusion

# I've never really used a dbm.
# They allow complicated structures, right?
$dbm{$name}{'age'} = 29;
Well, some do, and some dont... MLDBM certainly does, though your syntax wont work. Quoting from the pod:
Adding or altering substructures to a hash value is not entirely transparent in current perl. If you want o store a reference or modify an existing reference value in the DBM, it must first be retrieved and stored in a temporary variable for further modifications. In particular, something like this will NOT work properly:
$mldb{key}{subkey}[3] = 'stuff'; # won't work
Instead, that must be written as:
$tmp = $mldb{key}; # retrieve value $tmp->{subkey}[3] = 'stuff'; $mldb{key} = $tmp; # store value

This limitation exists because the perl TIEHASH interface currently has no support for multidimensional ties.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://241506]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2021-01-20 20:52 GMT
Find Nodes?
    Voting Booth?