Order of subroutines
From: Aris Xanthos (Aris.Xanthos_at_ling.unil.ch)
Date: 09/28/04
- Next message: Josef Moellers: "Re: Order of subroutines"
- Previous message: Graham Wood: "Re: printing array problem"
- Next in thread: Josef Moellers: "Re: Order of subroutines"
- Reply: Josef Moellers: "Re: Order of subroutines"
- Reply: Gunnar Hjalmarsson: "Re: Order of subroutines"
- Reply: Paul Lalli: "Re: Order of subroutines"
- Reply: Aris Xanthos: "Re: Order of subroutines"
- Reply: Tony Skelding: "Re: Order of subroutines"
- Reply: Andres Monroy-Hernandez: "Re: Order of subroutines"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Sep 2004 03:58:58 -0700
Hi,
I have a problem with the order of subroutines
and I couldn't find help about that in books or
online.
Could someone tell me why this code works fine:
------------------
#!/usr/bin/perl
Function1();
sub Function1() {
Function2( 'arg' );
}
sub Function2() {
my ( $arg ) = @_;
}
------------------
and not this one:
------------------
#!/usr/bin/perl
Function1();
sub Function2() {
my ( $arg ) = @_;
}
sub Function1() {
Function2( 'arg' );
}
------------------
which yields the following error message:
Too many arguments for main::Function2 at
D:\Developpement\Perl\test.pl line 10, near "'arg' )"
Execution of D:\Developpement\Perl\test.pl
aborted due to compilation errors.
I have this problem in the framework of a rather
long (tk) script (about 2'000 lines so far), and the
calls to various subroutines are getting too intricate
for me to find an order that works (besides, it is not
a satisfying solution).
I hope this does not duplicate a previous post.
Aris Xanthos
- Next message: Josef Moellers: "Re: Order of subroutines"
- Previous message: Graham Wood: "Re: printing array problem"
- Next in thread: Josef Moellers: "Re: Order of subroutines"
- Reply: Josef Moellers: "Re: Order of subroutines"
- Reply: Gunnar Hjalmarsson: "Re: Order of subroutines"
- Reply: Paul Lalli: "Re: Order of subroutines"
- Reply: Aris Xanthos: "Re: Order of subroutines"
- Reply: Tony Skelding: "Re: Order of subroutines"
- Reply: Andres Monroy-Hernandez: "Re: Order of subroutines"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|