in reply to looking for a good idiom: return this if this is true
I guess you're missing a set of parens there:
($_ = thatroutine()) ? return $_ : undef; [download]
$_ ? return $_ : undef for thatroutine(); #or simply return $_ if $_ for thatroutine(); [download]