Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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.

-Blake


Comment on Re4: Database storage confusion
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-07-25 00:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (167 votes), past polls