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 good point but for the
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 :)
snip
An
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 quite
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 marine?
Because you
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
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 true value.
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 value is 1 isn't
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?
.
-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.
#!/usr/bin/perl
marine()
sub marine {
$n
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.
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
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 you want to
-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
Andrew Curry [EMAIL PROTECTED] wrote:
That's rubbish
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() {
print hello\n;
}
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 if you want to
15 matches
Mail list logo