The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

Name

qbit::Hash - Functions to manipulate hashes.

Functions

hash_transform

Arguments:

  • $hs - hash ref, original hash;

  • $arr - array ref, keys to copy;

  • $transform_hs - hash ref, new keys names.

Return value: hash with new keys names.

my %new_hash = hash_transform(
{
a => 1,
b => 2,
c => 3,
d => 4
},
[qw(a c)],
{
d => 'e'
}
);
Result:
%new_hash = (
a => 1,
c => 3,
e => 4
)

push_hs

Arguments:

  • $h1|%h1 - hash or hash ref, first hash;

  • $h2|%h2 - hash or hash ref, second hash.

Merge second hash into first.