On 30 Aug 2007 at 1:18, anders wrote:

> 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 ;

Can't you! I always have my subroutines at the bottom of the file and 
the main part at the top. It works for me.

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


Reply via email to