Optional export, perhaps?
sub maybe_if ($$$@)
{
my $check = shift;
if ($check)
{
@_
}
else
{
(scalar @_ > 1) ? @_[2 ..$#_] : qw()
}
}
(Rather than me producing the same thing and releasing it separately,
seems like it belongs here?)
Basically, this would replace:
$foo ? ( key => $value ) : (),
in a list with:
maybe_if $foo => key => $value,
in the same list. (Ok, that first fat comma could just be a regular comma.)
If not, I can just create PerlX::Maybe::If, and put it there.
Thanks,