foo {} is a CALL to a function named foo, passing a hashref -
not a function declaration. You need a semi-colon after a function call.
update: well, most of the time - not at the end of a file or block, for example, but you
do need one before starting a new package.
You probably meant something like:
package foo;
sub foo {}
package foo::bar;
sub bar {}
Note the
subs.