C:\>perl -e "@foo=('one','two'); %m=('1'=>'one', '2'=>' two'); @m_h= grep{local($_);s/tw/tr/g; /^t.*/ig} @foo; print @m_h; print @foo" onetwo