http://qs1969.pair.com?node_id=917582


in reply to Re^4: How do I prototype a function with a varying number of arguments?
in thread How do I prototype a function with a varying number of arguments?

oO

Instinctively, I think maybe this is a trick question, but, nonetheless....like this?

&sub ($@[0], $@[1])

I mean, technically a reference to a single array element is a scalar variable, so, that would work then....right?

  • Comment on Re^5: How do I prototype a function with a varying number of arguments?
  • Download Code

Replies are listed 'Best First'.
Re^6: How do I prototype a function with a varying number of arguments?
by chromatic (Archbishop) on Jul 30, 2011 at 08:25 UTC
    I think maybe this is a trick question...

    How do you pass the contents of a two-element array to an unprototyped function which takes two scalar arguments?

    some_func( @two_elements );

    How do you pass the contents of a two-element array to a $$ prototyped function?

    some_func( $two_elements[0], $two_elements[1] );

    That looks less generic to me, as it forces callee details to the caller side.