in reply to Too Many IDs

Update: This answer isn't really helpful, sorry. Your solutions stores the same references under the sn's, so it should occupy memory comparable to my solution.

If your concern is memory, you can store just the "sn to id" map instead of storing all the data twice.

my %sn_to_id = map { $dat_by_id{$_}{sn} => $_ } keys %dat_by_id;

You then need to nest the references to get the value:

my $sn = 'b'; my $more = $dat_by_id{ $sn_to_id{$sn} }{more};

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: Too Many IDs
by LanX (Saint) on Jan 09, 2020 at 11:30 UTC
    Where is the benefit to the OP's code, where the values are just the identical hash refs and no flat copies?

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice