http://qs321.pair.com?node_id=1115921


in reply to Checking number of values returned

I'd say that unless you habitually and religiously always assign your functions to individual scalars, eg: my( $x, $y, $z ) = yourfunc();, then there is no way to do this check.

If you assign your function to:

  1. an array: my @vals =  yourFunc();
  2. or a hash: my %hash = yourFunc();
  3. or use it in a for loop: for my $x ( yourFunc() ){
  4. or to map;  ... map{ ... } yourFunc();
  5. or grep;  ... grep{ ... } yourFunc();
  6. or as an arg to any other function: someFunc( 1, 'fred', yourFunc() ); user or built-in;

then there is no way to know how many values it should return.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked