in reply to Can someone explain this error?

As well as the call to show us the code, let me let you in on perldoc perldiag and even better, the use diagnostics pragma. Both will help explain what error messages mean, and often enough suggest a fix.

A common enough mistake is

my %hash = { foo => 'bar', baz=> 'bletch'};

Those curlies {} should be parens ().

HTH