in reply to Localize $_ in grep

I think you want map and grep
@m_h = map { local $_ = $_; s/tw/tr/g; $_ } grep {/^t/i} @foo;