You can only write it that way because both clauses in the expression happen to call the same function. If the statement was:
/no_proc/ ? foo "$_\n"
: bar "$_ : in proc\n";
you could not have applied such a transformation, and the ?: would be left in void context.
But I don't understand the fear of void context of particular functions or operators. Some people claim to get utterly confused when encountering a map in void context, breaking their tiny little brains on the question whether the author might have intended something else. You don't seem to like ?: in void context. But then you happily use print in void context, totally ignoring its return value.
Me, I happily use anything in void context if that suits me. And I ain't afraid in the dark either. |