How would I go about sorting the following arrays in the following by the value in TIME?
$VAR1 = [
{
'TIME' => '45',
'PLAYER' => '',
'TYPE' => '6'
},
{
'INFO' => 'Dissent',
'TEAMFLAG' => '1',
'PLID' => '8570',
'TIME' => '85',
'PLAYER' => 'Player1',
'TYPE' => '4'
},
{
'TEAMFLAG' => '1',
'PLID' => '8570',
'TIME' => '35',
'PLAYER' => 'Player1',
'TYPE' => '1'
},
{
'TEAMFLAG' => '0',
'PLID' => '145399',
'TIME' => '60',
'PLAYER' => 'Player3',
'TYPE' => '1'
},
{
'TEAMFLAG' => '0',
'PLID' => '145248',
'TIME' => '12',
'PLAYER' => 'Player1',
'TYPE' => '1'
},
{
'TIME' => '0',
'PLAYER' => '',
'TYPE' => '10'
}
]
The above is a datadump of $data->{EVENTS}->{EVENT} which I need sorting, so have tried the following but it doesn't sort:
my @sorted = sort { $b->{TIME} <=> $a->{TIME} } $data->{EVENTS}->{EVENT};