NAME
Array::Join - SQL-like joins on Perl arrays (functional interface)
SYNOPSIS
use Array::Join;
my @rows = join_arrays(
\@left,
\@right,
{
on => [
sub { $_[0]{id} },
sub { $_[0]{id} },
],
type => 'left',
merge => 'LEFT_PRECEDENT',
}
);
DESCRIPTION
Array::Join provides a simple functional interface for performing SQL-style joins on two Perl arrays.
It is a thin wrapper around Array::Join::OO, exposing the same behavior and options without requiring object construction.
FUNCTIONS
join_arrays( \@array_a, \@array_b, \%options )
Performs a join between two arrays and returns the joined rows.
This function constructs an internal Array::Join::OO object and immediately executes the join.
All arguments and options are passed through unchanged.
Arguments
\@array_a
Left-hand array.
\@array_b
Right-hand array.
\%options
Join options. See "CONSTRUCTOR" in Array::Join::OO for full details.
OPTIONS
The %options hash supports the same keys as Array::Join::OO:
on
type
merge / as
Refer to Array::Join::OO for detailed semantics.
RETURN VALUE
Returns a list of joined rows. The exact structure of each row depends on the selected merge strategy.
ERRORS
Exceptions thrown by Array::Join::OO are propagated unchanged.
CAVEATS
This release is backwardly incompatible, in the unlilkely event that you used the past, horribly buggy version.
This was built for convenience, not performance. It's never been tested for very large arrays
SEE ALSO
AUTHOR
Simone Cesano <scesano@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2025 by Simone Cesano.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.