How To Install libhash-merge-perl on Ubuntu 18.04

In this tutorial we learn how to install libhash-merge-perl on Ubuntu 18.04. libhash-merge-perl is Perl module for merging arbitrarily deep hashes into a single hash

Introduction

In this tutorial we learn how to install libhash-merge-perl on Ubuntu 18.04.

What is libhash-merge-perl

libhash-merge-perl is:

Hash::Merge merges two arbitrarily deep hashes into a single hash. That is, at any level, it will add non-conflicting key-value pairs from one hash to the other, and follows a set of specific rules when there are key value conflicts (as outlined below). The hash is followed recursively, so that deeply nested hashes that are at the same level will be merged when the parent hashes are merged. Please note that self-referencing hashes, or recursive references, are not handled well by this method.

Values in hashes are considered to be either ARRAY references, HASH references, or otherwise are treated as SCALARs. By default, the data passed to the merge function will be cloned using the Clone module; however, if necessary, this behavior can be changed to use as many of the original values as possible. (See set_clone_behavior).

There are three methods to install libhash-merge-perl on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install libhash-merge-perl Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install libhash-merge-perl using apt-get by running the following command:

sudo apt-get -y install libhash-merge-perl

Install libhash-merge-perl Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install libhash-merge-perl using apt by running the following command:

sudo apt -y install libhash-merge-perl

Install libhash-merge-perl Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install libhash-merge-perl using aptitude by running the following command:

sudo aptitude -y install libhash-merge-perl

How To Uninstall libhash-merge-perl on Ubuntu 18.04

To uninstall only the libhash-merge-perl package we can use the following command:

sudo apt-get remove libhash-merge-perl

Uninstall libhash-merge-perl And Its Dependencies

To uninstall libhash-merge-perl and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove libhash-merge-perl

Remove libhash-merge-perl Configurations and Data

To remove libhash-merge-perl configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge libhash-merge-perl

Remove libhash-merge-perl configuration, data, and all of its dependencies

We can use the following command to remove libhash-merge-perl configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge libhash-merge-perl

References

Summary

In this tutorial we learn how to install libhash-merge-perl package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.