I guess you're missing a set of parens there:
($_ = thatroutine()) ? return $_ : undef; [download]
In reply to Re^2: Ternary? by ambrus in thread looking for a good idiom: return this if this is true by merlyn