my @data = function(); my @sorted = sort { $a->method <=> $b->method } @data; foreach my $item (@sorted) { $item->other_method; }
The error message I was getting:
Can't call method "other_method" on undefined value at line ...
The question to you is: how is that possible?
I think you'll smile if/when you realize the answer.