in reply to Use of uninitialized value in string comparison (cmp)

Hello,

sort needs to operate on $a and $b not on $_
#sorry win quote perl -wle "@r=({k=>'r'},{k=>'s'},{k=>'t'});print $_->{k} for sort { $a +->{k} cmp $b->{k} } @r;" r s t

L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: Use of uninitialized value in string comparison (cmp)
by Random_Walk (Prior) on Sep 16, 2015 at 10:57 UTC

    Aaarrgghhh, I knew I had been staring at it too long. I knew that, but it slipped out my memcache somewhere :(. Thanks for the reminder.

    Cheers,
    R.

    Pereant, qui ante nos nostra dixerunt!