On 30 Aug, 09:39, [EMAIL PROTECTED] (Amichai Teumim) wrote:
> Hi
>
> I'm trying to understand subroutines.
>
> #!/usr/bin/perl
>
> &marine()
>
> sub marine {
>   $n += 1; #Global variable $n
>   print "Hello, sailor number $n!\n";
>
> }
>
> This doesn't work. Is &marine() incorrect? How would I call the sub marine?
>
> Thanks
>
> Amichai

You can't use somting BEFORE you have created it try to call and
call sub with name and () and ;

 sub marine {
   $n += 1; #Global variable $n
   print "Hello, sailor number $n!\n";

marine();



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


Reply via email to