Re: Perl calculate and average problem



Josef Moellers <josef.moellers@xxxxxxxxxxxxxxxxxxx> wrote:
> Let's see if we can dig up something based upon your initial request:
> "calculate the average of the numbers, the total of
> all the numbers added together, and a new array of numbers which is the
> other numbers divided by 2."

> my $sum = 0, $avg = 0;

This should be either:

my $sum = 0, my $avg =0;
or

my ($sum, $avg);

otherwise $avg will fail 'use strict'.

Axel

.



Relevant Pages

  • Re: Regular Expressions with arrays
    ... use warnings; ... use strict; ... next if $prev; ... If you really want to handle it as an array, ...
    (perl.beginners)
  • Re: The last element
    ... > How can I call the last element in the array? ... use strict; ... use warnings; ... Prev by Date: ...
    (perl.beginners)
  • Re: matching password problem
    ... and turn on warnings. ... You don't need to store the usernames and passwords in arrays in your code, because you only need to look at ONE username and ONE password at a time. ... And if you DID want to store them, you should use a hash, not an array. ... use strict; use warnings; ...
    (perl.beginners)
  • Re: delimited data into nested array
    ... > Perl as a two dimensional nested array. ... warnings is a more modern replacement for -w: ... strict helps catch common coding errors. ...
    (comp.lang.perl.misc)
  • Re: Module questions (perhaps a module creation mini-tutorial)
    ... > use warnings; ... > use strict; ... You shouldn't be using this array. ... > package I am calling. ...
    (perl.beginners)