in reply to Re: how to avoid a reference?
in thread how to avoid a reference?

dbmopen and dbmclose are not AFAIK deprecated. There is a note in perlfunc that they are "largely superseded by" tie and untie, but it takes several lines to get tie to do what dbmopen does for you.

Replies are listed 'Best First'.
Re^3: how to avoid a reference?
by tilly (Archbishop) on Aug 08, 2004 at 08:29 UTC
    Several lines? Let me compare:
    # Using dbmopen dbmopen(my %foo, 'data.db', 0666); # time passes... dbmclose(%foo); # Using tie use DB_File; tie(my %foo, 'DB_File', 'data.db'); # time passes... untie(%foo);
    Doesn't seem like that much extra to me.

    Furthermore dbmopen and dbmclose may not be officially deprecated, but I'd suggest that people not use them.

    Of course if you don't mind the possibility that installing a new module will cause working scripts to break and you to be left not knowing how to get at your data, then by all means ignore my advice. The extra information that you have to supply for tie removes a potentially painful ambiguity.

    (The fault actually lies with AnyDBM_File.)