Re: sub routine syntax

2004-09-06 Thread Ing. Branislav Gerzo
Mike Blezien [MB], on Monday, September 06, 2004 at 15:40 (-0500) has
on mind:

MB> 1) some_subroutine();

use this one.

MB> is one a more prefered or more effecient to use then the other(s)??

I think is a more prefered, about eficienty it is same. &sub() is good
only when it has the same name as other standard subroutine, and you
"pretype" it and use it within main().

-- 

 ...m8s, cu l8r, Brano.

[A Weasel is a ferret with seniority.]



-=x=-
Skontrolované antivírovým programom NOD32


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: sub routine syntax

2004-09-06 Thread Randy W. Sims
Mike Blezien wrote:
Hello All,
We've been revamping alot of our older perl scripts and a question came 
up that I wasn't a 100% clear on. When calling sub routines, is there a 
significate difference in these formats:

1) some_subroutine();
2) &some_subroutine;
This syntax has the special property that it passes the arguments of the 
current sub into the sub being called:

#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
sub a {
print 'a: ' . Dumper([EMAIL PROTECTED]);
&b;
}
sub b {
print 'b: ' . Dumper([EMAIL PROTECTED]);
}
a(1,2,3);
__END__
3) &some_subroutine();
is one a more prefered or more effecient to use then the other(s)??
use (1)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]