No, the subroutinue body can occur before or after the invokation point with or without the &.
joel -----Original Message----- From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]] Sent: 06 June 2002 14:24 To: 'Janek Schleicher'; [EMAIL PROTECTED] Subject: RE: subroutine or &subroutine Janek, Wouldn't it print: foo: &foo:A B C Also, I believe that you must declare the subroutine before you are allowed to reference it without the &. Am I right about that? -----Original Message----- From: Janek Schleicher [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 05, 2002 5:10 AM To: [EMAIL PROTECTED] Subject: Re: subroutine or &subroutine Kevin Christopher wrote at Wed, 05 Jun 2002 04:58:38 +0200: > Yes, you can call subroutines either way, with or without the "&". The only case when the > subroutine must be prefixed with an ampersand is, I believe, when you're assigning a reference > variable, eg: > > $reference_x = \&subroutine_y; > > But that's another story. > Oh, I'm afraid that's not the truth :-) &subroutine without any arguments calls the subroutine with the implicit @_ array, while subroutine only calls subroutine() without any argument. Look at this snippet: @_ = qw(A B C); print 'foo:'; foo; print "\n"; print '&foo:'; &foo; print "\n"; sub foo { print @_; } It prints: foo: &foo:ABC Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]