in reply to Re^3: do $n exist in grep?
in thread do $n exist in grep?

return { status => $s, ($optional_field ? (optional_field => $optional_field) : ()), };
I personally would not make a hash key optional like that.
I would always return the hash key and then an undef value for that key if it is not valid.
But as is often said "there is more than one way to do it".
It could also be that I haven't thought this completely through and haven't considered what
the calling code looks like and how it processes this returned info.