Perl sortdoes not modify the array; it returns a sorted list. You should assign this list somewhere (either back to the original array, or somewhere else).
@{ $hash{$item}{'lengths'} } = sort @{ $hash{$item}{'lengths'} };
Or (especially if the array is in a deep nested hash):
my $arrayref = $hash{$item}{'lengths'};
@$arrayref = sort @$arrayref;
Your source code would sort the array and then throw away the sorted list, so it gives this warning.
.. salva , sort . , , sort { $a <=> $b } sort:
my $arrayref = $hash{$item}{'lengths'};
@$arrayref = sort { $a <=> $b } @$arrayref;
, .