Acme-RJWETMORE-Utils

 view release on metacpan or  search on metacpan

lib/Acme/RJWETMORE/Utils.pm  view on Meta::CPAN

package Acme::RJWETMORE::Utils;
use 5.018;
use Exporter qw(import);
our @EXPORT  = qw(sum);

=head1 NAME

Acme::RJWETMORE::Utils 

=head1 VERSION

Version 0.01

=cut

our $VERSION = '0.01';


=head1 SYNOPSIS

Algebraically adds a list of numbers.  Numbers can be positive or negative.
They can be integers or floating points.  They can be decimal, binary, 
hexadecimal, octal or mixed bases.  


    use Acme::RJWETMORE::Utils;

    my $result = sum( $n1, $n2, ... );

    # Examples and special cases:
    sum( 1, -2, 3, -4 )       # -2
    sum()                     # undef 
    sum(1, 2, 'a' )           # 3 
    sum( 'a', 'b' )           # 0 
    sum( 0b11, 0xA, 010, 20 ) # 41 

=head1 EXPORT

sum()

=head1 SUBROUTINES/METHODS

=head2 sum

Algebraically adds a list of numbers.

=cut

sub sum {

    if ( !@_ ) { return }

    my @terms = @_;
    my $answer = 0;
    foreach my $term (@terms) {
        $answer+=$term;
    }
    return $answer;
}


=head1 AUTHOR

Bob Wetmore, C<< <whataboutbobw at gmail.com> >>

=head1 BUGS

Please report any bugs or feature requests to C<bug-acme-rjwetmore-utils at rt.cpan.org>, or through
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme-RJWETMORE-Utils>.  I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.




=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Acme::RJWETMORE::Utils


You can also look for information at:

=over 4

=item * RT: CPAN's request tracker (report bugs here)

L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Acme-RJWETMORE-Utils>

=item * AnnoCPAN: Annotated CPAN documentation

L<http://annocpan.org/dist/Acme-RJWETMORE-Utils>



( run in 0.714 second using v1.01-cache-2.11-cpan-d80b1682f3f )