Rus You can't use the concatenation character on hashes. It's for "str"."ings" only.
>From what you've said, you just need to set each hash entry: $hash{1} = { url => "www.slashdot.org" , title => "News for nerds" , lastvisit =>" 100000" }; $hash{2} = { url => "www.slashdot.org" , title => "News for nerds" , lastvisit =>" 100000" }; But are you sure you shouldn't just be using an array? push @array, { url => "www.slashdot.org" , title => "News for nerds" , lastvisit =>" 100000" }; push @array, { url => "www.slashdot.org" , title => "News for nerds" , lastvisit =>" 100000" }; HTH. Rob ----- Original Message ----- From: "Rus Foster" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, October 15, 2002 2:31 PM Subject: MLDBM adding records > Hi all, > I'm trying to do a proof of concept for myself using MLDBM of basically > trying to add two records to a hash. ATM I have the following code > > #!/usr/bin/perl > > use strict ; > use warnings ; > use MLDBM; > use Fcntl ; > > my %hash ; > my $filename = "/tmp/filt" ; > unlink $filename ; > > my $db = tie(%hash, 'MLDBM', $filename, O_RDRW|O_EXLOCK, 0640) or die > ("Cannot open $filename: $!\n"); > > %hash = ( '1' => { url => "www.slashdot.org" , title => "News for > nerds" , lastvisit =>" 100000" } ); > %hash .= ( '2' => { url => "www.slashdot.org" , title => "News for > nerds" , lastvisit =>" 100000" } ); > > > print Data::Dumper->Dump ( [\%hash ]); > undef $db; > untie %hash; > > and I'm getting > > Can't modify private hash in concatenation (.) or string at ./perldbm line > 15, near ");" > > As such what do I have to do to add entries to the hash (without defining > it all in one hash?) The reason is that I want to writ eaprorgam that will > add a hash each time it is run so just trying to do it on a simple prog > ATM > > Rus > -- > http://www.fsck.me.uk - My blog > http://shells.fsck.me.uk - Hosting how you want it. > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]