> testsub(35);

You call the sub with one parameter, integer 35. However, this won't
work as calling the sub before the sub is defined with a prototype will
barf with an error. Let's assume had the sub call beneath the definition
from the start.

> sub testsub($)

Above, your prototype says testsub() will only take a single parameter,
nothing more.

>    my $self = shift;

Above, you shift off the first and only parameter (as defined by the
prototype) directly into the $self variable.

This essentially leaves the rest of @_ empty, populating $id with 0, or
nothing.

>    my $id = @_;
>    print "$id";

Had you of actually tested the code, you would of found this. If you had
of inserted a print for $self, you would of seen that it took the only
parameter leaving $id blank.

Steve

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to