NAME
Business::BR::Ids::Common - Common code used in Business-BR-Ids modules
SYNOPSIS
use Business::BR::Ids::Common qw(_dot);
my @digits = (1, 2, 3, 3);
my @weights = (2, 3, 2, 2);
my $dot = _dot(\@weights, \@digits); # computes 2*1+3*2+3*2+2*3
DESCRIPTION
This module is meant to be private for Business-BR-Ids distributions. It is a common placeholder for code which is shared among other modules of the distribution.
Actually, the only code here is the computation of the scalar product between two array refs. In the future, this module can disappear being more aptly named and even leave the Business::BR namespace.
- _dot
-
$s = dot(\@a, \@b);
Computes the scalar (or dot) product of two array refs:
sum( a[i]*b[i], i = 0..$#a )
Note that due to this definition, the second argument should be at least as long as the first argument.
EXPORT
None by default.
You can explicitly ask for _dot()
which is a sub to compute the dot product between two array refs (used for computing check digits).
SEE ALSO
Please reports bugs via CPAN RT, http://rt.cpan.org/NoAuth/Bugs.html?Dist=Business-BR-Ids
AUTHOR
A. R. Ferreira, <ferreira@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2005 by A. R. Ferreira
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.