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]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to