while (my$file = @files) {...} is an infinite loop, and the variable $file will just be a number, not a filename. The intention was probably something like while (my $file = shift @files) {...}, though the following would be safer: while (@files) {my $file = shift @files; ...} (just in case there is a file named "0").
use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name