use Scalar::Util qw( refaddr ); defined(refaddr($sorted[0])) && refaddr($o) == refaddr($sorted[0])