NAME

AmberDB::Array - Array and matrix manipulation utilities

SYNOPSIS

use AmberDB::Array;
my $array_util = AmberDB::Array->new();
my $intersection = $array_util->array_crop($arr1, $arr2);
my @sorted = $array_util->array_sort('num', 'desc', 0, @records);

DESCRIPTION

AmberDB::Array provides array operations including deduplication, intersection, difference, matrix transposition, sorting, deep copying, and element shuffling.

METHODS

array_nodup(@array)

Removes duplicates while preserving order.

array_crop($arr1, $arr2, ...)

Returns intersection of array references.

array_add($arr1, $arr2, ...)

Merges array references without duplicates.

array_punch($primary_arr, @other_arrs)

Subtracts items in other arrays from primary array.

array_sort($type, $direct, $field, @records)

Sorts a list of scalars or list of array references. $type can be 'num' or 'ascii' (auto-detected if omitted). $direct is 0/'asc' (ascending) or 1/'desc' (descending). $field is the sub-element index when sorting array references. If $field = 0, compares $a->[0] and $b->[0].

deep_copy($data)

Performs deep copy of array/hash references.

AUTHOR

Maruf Cetin <marufcetin@gmail.com>

LICENSE AND COPYRIGHT

Copyright (C) 2018-2026 Maruf Cetin.

This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.