October 30th, 2005


Fun bug

Here's a fun bug. See if you can find what's happening:
my @data = function();
my @sorted = sort { $a->method <=> $b->method } @data;

foreach my $item (@sorted) {

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.