in reply to warning "Out of memory!"

You're not showing us your full code. You don't even show where you're reading the input. So don't expect many especially useful answers.

At a guess, you're slurping the entire file into memory, when perhaps you'd be better off processing it line by line.

That said, 30 MB is not a large file by modern standards, and should fit in memory quite easily.

use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name