in reply to Re: Filtering text file made into hash
in thread Filtering text file made into hash

my %names = ();

is better as:

my %names;

Hashes and arrays are made fresh (and empty) when they are declared so you don't need to clutter code with redundant initialization.

Avoid nested blocks. Your for loop is better written:

for my $name (sort keys %names) { # Skip if fewer than 4 occurrences of name or none over 50 next if @{$names{$name}} < 4 || !any {$_ > 50} @{$names{$name}}; say "$name: ", join ",", @{$names{$name}}; }

Use early exits to avoid nesting in loops and subs. Nested blocks makes logic flow much harder to analyze. Using early exits allows a simple to understand list of test/handle/bail steps.

Premature optimization is the root of all job security