dbmopen syntax error

S

shao

Hi, I am a newbie to perl programing.
I am trying to map a hash out into disk file.
This is the sample I tried:
dbmopen(%last_good,"lastdb",0666) || die "Failed dbmopen: $!";
$last_good($name) = time;
dbmclose(%last_good);

But I keep getting this error:
syntax error at lesson4.pl line 21, near "$last_good("

Can anyone please tell me what I did wrong?
 
U

usenet

shao said:
$last_good($name) = time;

That's a hash. The syntax is to use curly's (not parens), ie:
$last_good{$name}

That might be in the perldoc's somewhere...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top