For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > January 2008 > Re: sorting a list of objects using one of their methods? RESOLVED









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: sorting a list of objects using one of their methods? RESOLVED
Grady Weyenberg

2008-01-24, 10:16 pm

On Wed, 23 Jan 2008 19:09:08 +0000, John Bokma wrote:
>
> Sounds like you don't have only objects refs in your list, try to debug
> with:
>
> for my $item ( @list ) {
>
> print ref $item, "\n";
> }
>
> to see what you have in your list.
>
> (Note: if your list is very long, and your name function is slow, you
> might want to use a "Schwartzian Transform".)


Thanks for the pointer and optimization tip. Turns out that my original
code worked after all, the problem was that my list was populated with
undefs due to a subtle earlier bug, but the error text mislead me. The
ref function should help me avoid that in the future.

thanks,
Grady

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com