in reply to Re^4: mystery function & Odd number of elements in anonymous hash
in thread mystery function & Odd number of elements in anonymous hash

I am not too certain about your "wrapper" function.

It gives you an undef in case of a missing result, but it will only show the "first" element of the hash, array or list and you will loose the possibility to recognize multiple results.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^6: mystery function & Odd number of elements in anonymous hash
by Anonymous Monk on Jul 18, 2011 at 21:18 UTC

    I am not too certain about your "wrapper" function.

    I'm happy with it. The vast majority of cases return zero or one results. Multiple results are rare, and I know when to expect them and handle them separately. I can always call the original function when such things are needed.

    I still think that it makes sense for the fat comma to effect scalar context, though.

      I still think that it makes sense for the fat comma to effect scalar context, though.

      It wouldn't be a comma operator if it did. The comma operator builds lists.