in reply to pop sort strangeness

Sort returns a list, not an array. An array is the container for a list. Pop needs to have a container so that it can remove an element.

If you want the last element of a list, you can use a literal slice:

my $max = (... list ...)[-1];
Also, if you're sorting numbers, you'll want to look into user-defined sorts. The built-in sort sorts as strings, which will mess up your day on numbers.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.