#!/usr/bin/perl use 5.010; use strict; use warnings; use Devel::Size qw [total_size]; my $size = 250_000; my @fields = qw [chr start end symbol strand]; my %families; my @structs = \my (%chr, %start, %end, %symbol, %strand); foreach my $key (1 .. $size) { $families{$key}{$_} = undef for @fields; $$_{$key} = undef for @structs; } my $s1 = total_size \%families; my $s2 = 0; $s2 += total_size $_ for @structs; printf "Big hash: %d Mb\n", $s1 / (1024 * 1024); printf "More hashes: %d Mb\n", $s2 / (1024 * 1024); printf "Savings: %.0f%%\n", 100 * ($s1 - $s2) / $s1; __END__ Big hash: 71 Mb More hashes: 61 Mb Savings: 14%