Business::BR::Ids::Common - Common code used in Business-BR-Ids modules
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
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.
$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.
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).
_dot()
Please reports bugs via CPAN RT, http://rt.cpan.org/NoAuth/Bugs.html?Dist=Business-BR-Ids
A. R. Ferreira, <ferreira@cpan.org>
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.
To install Business::BR::Ids, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Business::BR::Ids
CPAN shell
perl -MCPAN -e shell install Business::BR::Ids
For more information on module installation, please visit the detailed CPAN module installation guide.