R. Joseph Newton wrote:

 > > Hi Malik,
 > >
 > > If you pass a reference to the array as the first argument as below
 > you can
 > > keep the array separate from the other arguments you are passing.
 > >
 > > @abc = qw(1 2 3);
 > > $x = 4;
 > > $y = 5;
 > >
 > > testsub([EMAIL PROTECTED], $x, $y);
 > >
 > > sub testsub($$$)
 > > {
 > >     ($abc, $x, $y) = @_;
 > >     print "Array @$abc\n";
 > >     print "x $x\n";
 > >     print "y $y\n";
 > > }
 >
 > Thank you for using the clear scalar syntax in your prototype.
 >
 >
 > Joseph

Yes, but now you explicitly pass an array reference. As you have said, 
this is better for readability. If this is just any darn subroutine that 
you are using yourself, you shoud do it this way (Actually, then I 
wouldn't prototype at all). But, if this is being exported, what is the 
harm of "sub testsub ([EMAIL PROTECTED])"? If a beginner can understand the concept 
of prototyping and referencing, I think they can gather an array 
reference is being passed. When you program for an end-user programmer, 
  you should use [EMAIL PROTECTED] if you prototype something like this.

-will
(the above message is double rot13 encoded for security reasons)

Most Useful Perl Modules
-strict
-warnings
-Devel::DProf
-Benchmark
-B::Deparse
-Data::Dumper
-Clone (a Godsend)
-Perl::Tidy
-Beautifier


-- 
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