How To Install libsort-key-top-perl on Ubuntu 18.04

In this tutorial we learn how to install libsort-key-top-perl on Ubuntu 18.04. libsort-key-top-perl is Perl module to select and sort top n elements of a list

Introduction

In this tutorial we learn how to install libsort-key-top-perl on Ubuntu 18.04.

What is libsort-key-top-perl

libsort-key-top-perl is:

The functions available from this module select the top n elements from a list using several common orderings and custom key extraction procedures.

They are all variations around ‘keytopsort { CALC_KEY($_) } $n => @data;’.

In array context, this function calculates the ordering key for every element in @data using the expression inside the block. Then it selects and orders the $n elements with the lower keys when compared lexicographically.

In scalar context, the value returned by the functions on this module is the cutoff value allowing to select nth element from the array.

There are three methods to install libsort-key-top-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 libsort-key-top-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 libsort-key-top-perl using apt-get by running the following command:

sudo apt-get -y install libsort-key-top-perl

Install libsort-key-top-perl Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install libsort-key-top-perl using apt by running the following command:

sudo apt -y install libsort-key-top-perl

Install libsort-key-top-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 libsort-key-top-perl using aptitude by running the following command:

sudo aptitude -y install libsort-key-top-perl

How To Uninstall libsort-key-top-perl on Ubuntu 18.04

To uninstall only the libsort-key-top-perl package we can use the following command:

sudo apt-get remove libsort-key-top-perl

Uninstall libsort-key-top-perl And Its Dependencies

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

sudo apt-get -y autoremove libsort-key-top-perl

Remove libsort-key-top-perl Configurations and Data

To remove libsort-key-top-perl configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge libsort-key-top-perl

Remove libsort-key-top-perl configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge libsort-key-top-perl

References

Summary

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