in reply to s/// operator and undef question...

It took me a few minutes to see why it's working, and why you can't use it in general.
  1. You are likely missing a /g on the end of that regex match.
  2. What's happening is that $is is getting set to a list of two items, causing the loop to execute twice. The two values are ignored for the next step though.
  3. Since the last regex computed is is, that makes the substitute inside the loop work as if you had said $target =~ s/is/are/. Yup. Always scanning from the left.
So, the only reason this works is because the replacement string cannot once again match the search string. But try it with s/is/iis/, and you'll be totally hosed.

-- Randal L. Schwartz, Perl hacker