Surely you meant DBM::Deep->new( './test.dbm' );. Note the arrow operator, not a double colon :)

There is info in the docs about autovivification (update: The proper documentation segment). Try doing this instead and see if it works:

$db->{test} = {}; $db->{test}->{fred} = [ 1 .. 10 ]; $db->{test}->{bill} = [ 'a' .. 'z' ]; # if the above doesn't work either, try the # following ridiculous snippet: $db->{test} = {}; $db->{test}->{fred} = []; push( @{ $db->{test}->{fred} }, $_ ) for ( 1 .. 10 ); $db->{test}->{bill} = []; push( @{ $db->{test}->{bill} }, $_ ) for ( 'a' .. 'z' );

update: It's your command line switches. 'l', the line ending one is making this happen somehow. I tried mucking around with your script and as soon as the '-l' switch is removed it's all fine. Final working script:

#!c:/perl/bin/perl -w use strict; use DBM::Deep; use Data::Dumper; unlink './test.dbm'; my $db = DBM::Deep->new( './test.dbm' ); $db->{test} = { fred => [ 1 .. 10 ], bill => [ 'a' .. 'z' ] }; print Dumper $db;

In reply to Re: DBM::Deep problems by saskaqueer
in thread DBM::Deep problems by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.