logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SHARYANTO::Hash::Util - Hash utilities

Author

       perlancar <perlancar@cpan.org>

Bugs

       Please report any bugs or feature requests on the bugtracker website
       <https://rt.cpan.org/Public/Dist/Display.html?Name=SHARYANTO-Utils>

       When submitting a bug or request, please include a test-file or a patch to an existing test-file that
       illustrates the bug or desired feature.

Functions

rename_key(\%hash,$old_key,$new_key)
       Rename key. This is basically $hash{$new_key} = delete $hash{$old_key} with a couple of additional
       checks. It is a shortcut for:

        die unless exists $hash{$old_key};
        die if     exists $hash{$new_key};
        $hash{$new_key} = delete $hash{$old_key};

   replace_hash_content($hashref,@pairs)=>$hashref
       Replace content in <$hashref> with @list. Return $hashref. Do not create a new hashref object (i.e. it is
       different from: "$hashref = {new=>"content"}").

       Do not use this function. In Perl you can just use: "%$hashref = @pairs". I put the function here for
       reminder.

Homepage

       Please visit the project's homepage at <https://metacpan.org/release/SHARYANTO-Utils>.

Name

       SHARYANTO::Hash::Util - Hash utilities

See Also

       SHARYANTO

Source

       Source repository is at <https://github.com/perlancar/perl-SHARYANTO-Utils>.

Synopsis

        use SHARYANTO::Hash::Util qw(rename_key);
        my %h = (a=>1, b=>2);
        rename_key(\%h, "a", "alpha"); # %h = (alpha=>1, b=>2)

Version

       This document describes version 0.77 of SHARYANTO::Hash::Util (from Perl distribution SHARYANTO-Utils),
       released on 2015-09-04.

See Also