Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2017-05-28 10:40 GMT
Find Nodes?
    Voting Booth?