On Wed, Oct 5, 2016 at 11:59 PM, Sam Kington <sam@illuminated.co.uk> wrote: > > There are two related things that annoy me about writing Perl at the > moment. The first is the way hashes are just lists packed into pairs, so if > you say > > mandatory( > thing => $thing, > this => this_does_something(), > that => that_does_something(), > ); > > and this_does_something() returns an empty list, you end with it > collapsing to e.g. mandatory(thing => $thing, this => ‘that’, > $whatever_that_returned) and Perl complains about an odd-numbered list. > Without testing or consulting documentation, I understand that one of the things fat-comma does is put its left side in SCALAR context. That can be used to make your example do what you want, by using fat commas between the pairs instead of just between the keys and values. Without violating the expectation that fat comma is only used after keys, wrapping the function calls in scalar(do_something()) should coerce empty list to undef also. I didn't fully understand the second gripe but I think it might evaporate based on the above answer. David Nicol (seeking part time telecommuting perl hacking work at the moment) -- "Teaching radical novelties is our main safeguard against dictatorships" -- Edsger W. DijkstraThread Previous | Thread Next