in reply to Re: pop sort strangeness
in thread pop sort strangeness

I came up with a one-line pop solution:
my $max = pop @{@vals=sort @vals; \@vals};
It's kind of cheating in the "one-line" department, and I don't recommend it as clear programming, but it illustrates that "a BLOCK returning a reference" really means a BLOCK, not just an expression in curlies. Obviously the clear way to write it would be
@vals = sort @vals; my $max = pop @vals;

Caution: Contents may have been coded under pressure.