in reply to Re^2: read-only error
in thread read-only error

$a and $b are read-only in a sort block.

@list = sort { $a = 1; } @list;

You're getting the error because you are attempting to auto-vivify them.

I hate auto-vivification, or at least that it's on by default.