# The lines from here to the =cut are part of Perl's
# internal documentation system.  If you want 
# view the documentation use the command:
#
#	pod2text <script>
#
=pod

=head1 NAME

test_ave.pl - Test the moving average program

=head1 SYNOPSIS

    perl test_ave.pl 

=head1 DESCRIPTION

The I<test_ave.pl> reads a series of numbers from I<num.txt>
and print a moving average spanning three data points.

=head1 EXAMPLES

Sample run:

	perl test_ave.pl
	Read 64 items
	Moving average
	4.59666666666667
	4.60666666666667
	4.64
	4.67666666666667
	4.71
	...

=head1 AUTHOR

Steve Oualline, E<lt>oualline@www.oualline.comE<gt>.

=head1 COPYRIGHT

Copyright 2002 Steve Oualline.
This program is distributed under the GPL.  

=cut
use strict;
use average;
use vars qw(@raw_data);

my $flag = read_data("num.txt");
if (not $flag) {
   die("Could not read file");
}

my $element_count = $#raw_data + 1;
print "Read $element_count items\n";

my @average = moving_average(3);
print "Moving average\n";
foreach my $item (@average)
{
    print "$item\n";
}
