Andrew Gaffney wrote: > > Charles K. Clarkson wrote: > > Andrew Gaffney <[EMAIL PROTECTED]> wrote: > > : > > : I'm trying to write a subroutine that takes two scalars and two > > : arrays as parameters. I've read that if you try to do this in a > > : function, both arrays will get combined within '@_'. > > > > Andrew, > > > > - Stop using prototypes. You'll find it easier to write perl > > programs without them. > > But don't prototypes make debugging a little easier by throwing warnings > if you're not passing the correct types of arguments to the function?
Yes if the prototype is seen before the sub is called. However if you use an ampersand when you call the sub then the prototype will be ignored. # define prototype sub my_sub ([EMAIL PROTECTED]@); # call the sub - look - no parens! my_sub $scalar1, $scalar2, @array1, @array2; # call the sub - bypass prototypes! - oops &my_sub( $scalar3 ); # define sub sub my_sub ([EMAIL PROTECTED]@) { my ( $x, $y, $ref1, $ref2 ) = @_; ... } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>