Kevin Pfeiffer said:

>    sub speak {
>      my $either = shift;
>      if (@_) {                   # something to say
>        my $dialogue = shift;
>        print $either->name, " says, \"$dialogue\"!\n";
>      } else {
>        print $either->name, " goes ", $either->sound, "!\n";
>      }
>    }

> print $john->speak("Hello");
>
> This works fine except...
>
> sputnik:~/-> ./animals
> John says, "Hello"!
> 1sputnik:~/->
>
> You'll see there is a "1" after the 'speak' routine's output (each time).
> I can't see where the "1" comes from.

Your speak method prints something and returns true if it is successful
(the print being the last statement in the method so its return value is
returned from the method).  You then print that value, which happens to be
1.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to