# load data into a list of hash-refs my @data = ( { Subject => 'ID12', Query => 'KBrH', start => 22400316, ... }, ... ); my @sorted = sort { $a->{Subject} cmp $b->{Subject} or $a->{start} <=> $b->{start} } @data;