Like the others have said, a HoH structure will work. (There are others, but that is probably the best.) If you have trouble wrapping your head around how this structure "looks", try using
Data::Dumper:
use Data::Dumper;
print Dumper(\%details), "\n";