in reply to perl 5.38: can the body of a class declaration contain arbitrary code?

my variables in class would behave as they do in a package, per ...

The class keyword declares a new package which is intended to be a class
...
class and package declarations are similar, but classes automatically get a constructor named new - You don't have to (and should not) write one.