Re: marine subroutine

2007-08-31 Thread Dr.Ruud
"Chas Owens" schreef: > An article would be redundant, we already have Tom Christiansen's > masterful article "Far More Than Everything You've Ever Wanted to Know > about Prototypes in Perl"*. [...] > * http://library.n0i.net/programming/perl/articles/fm_prototypes/ OK, thanks. I presume it is qu

Re: marine subroutine

2007-08-31 Thread Chas Owens
On 8/31/07, Dr.Ruud <[EMAIL PROTECTED]> wrote: snip > This is nice content, but not presented well, so I wonder how many > people take the time to read and grok it. > > Maybe you can transform it into an article, maybe both on this list and > on PerlMonks? > > (and please give away the answers :) s

Re: marine subroutine

2007-08-31 Thread Dr.Ruud
"Chas Owens" schreef: > Martin Barth: >> Andrew Curry: >>> That's rubbish, >> >> but you get a warning like: >> >> main::a() called too early to check prototype at -e line 1. >> >> Use Prototypes at the beginning of your file if you want to write the >> subs at the end. > snip > > This would be a

Re: marine subroutine

2007-08-30 Thread Chas Owens
On 8/30/07, Martin Barth <[EMAIL PROTECTED]> wrote: > On Thu, 30 Aug 2007 15:39:14 +0100 > Andrew Curry <[EMAIL PROTECTED]> wrote: > > > That's rubbish, > > but you get a warning like: > > main::a() called too early to check prototype at -e line 1. > > Use Prototypes at the beginning of your file i

Re: marine subroutine

2007-08-30 Thread Martin Barth
Hi, > I don't get that either !!! > > #!/bin/perl > ### junk.pl ### > use strict; > use warnings; > > sayhello(); > > > sub sayhello { > > print "hello\n"; > > } thats because you're not using perls prototyping feature at all. if you define your sub that way: sub sayhallo() { p

Re: marine subroutine

2007-08-30 Thread Digger
> -Original Message- > From: [EMAIL PROTECTED] > Sent: Thu, 30 Aug 2007 16:34:08 +0100 > To: beginners@perl.org > Subject: Re: marine subroutine > > On 30 Aug 2007 at 17:29, Martin Barth wrote: > >> On Thu, 30 Aug 2007 15:39:14 +0100 >> An

Re: marine subroutine

2007-08-30 Thread Beginner
On 30 Aug 2007 at 17:29, Martin Barth wrote: > On Thu, 30 Aug 2007 15:39:14 +0100 > Andrew Curry <[EMAIL PROTECTED]> wrote: > > > That's rubbish, > > but you get a warning like: > > main::a() called too early to check prototype at -e line 1. > > Use Prototypes at the beginning of your file if

Re: marine subroutine

2007-08-30 Thread Martin Barth
On Thu, 30 Aug 2007 15:39:14 +0100 Andrew Curry <[EMAIL PROTECTED]> wrote: > That's rubbish, but you get a warning like: main::a() called too early to check prototype at -e line 1. Use Prototypes at the beginning of your file if you want to write the subs at the end. HTH, Martin -- To unsub

Re: marine subroutine

2007-08-30 Thread Beginner
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"; > > >

RE: marine subroutine

2007-08-30 Thread Andrew Curry
t;; } Works fine. -Original Message- From: anders [mailto:[EMAIL PROTECTED] Sent: 30 August 2007 09:18 To: beginners@perl.org Subject: Re: marine subroutine On 30 Aug, 09:39, [EMAIL PROTECTED] (Amichai Teumim) wrote: > Hi > > I'm trying to understand subroutines. > >

Re: marine subroutine

2007-08-30 Thread anders
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 cal

Re: marine subroutine

2007-08-30 Thread Amichai Teumim
Yeah that works now. Great. Finally I'm getting this...after months. Thank you. On 8/30/07, Jeff Pang <[EMAIL PROTECTED]> wrote: > > 2007/8/30, Amichai Teumim <[EMAIL PROTECTED]>: > > > > I get the error: > > > > sub-lib.pl did not return a true value at ./sub.pl line 5. > > > > Why is that? The v

Re: marine subroutine

2007-08-30 Thread Jeff Pang
2007/8/30, Amichai Teumim <[EMAIL PROTECTED]>: > > I get the error: > > sub-lib.pl did not return a true value at ./sub.pl line 5. > > Why is that? The value is 1 isn't it? > to add 1 at the end of sub-lib.pl,it would work. echo 1 >> sub-lib.pl when 'require'ing a file,perl need it to return a tr

Re: marine subroutine

2007-08-30 Thread Martin Barth
Hi, be nice to yourself and allways "use strict;" and don't call subs with &, unless you know why you need &. hopefully you can avoid some problems when you're writing perl code. #!/usr/bin/perl use strict; marine(); HTH, Martin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For add

Re: marine subroutine

2007-08-30 Thread Jeff Pang
2007/8/30, Amichai Teumim <[EMAIL PROTECTED]>: > 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 mar