#!/usr/bin/env perl use strict; use warnings; use Data::Dumper; my @times = qw(1000 1000 1000 1010 1010 1010); my $hash = {}; my $ord; for my $time (@times) { my $event = { one => 1, two => 2, ord => $ord++ }; push @{$hash->{$time}}, $event; } print Dumper $hash;