Hello Chris,

> Can this subroutine be better written?
> I am getting the following erros:
>
> Use of uninitialized value $y in subtraction (-) at form.pl line 52.
> Use of uninitialized value $y in addition (+) at form.pl line 52.
>
> sub avg_az {
>   my($x, $y) = shift(@_);

In the above line, `shift` will return just the first element from the
@_ array. $y will therefore be undefined. The line should be rewritten
as:
    my ( $x, $y ) = @_;

Relevant documentation: `perldoc -f shift` or
http://perldoc.perl.org/functions/shift.html

Regards,
Alan Haggai Alavi.
-- 
The difference makes the difference

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to