in reply to a Couple of questions!

  1. You want to use the /g modifier, and get the number of elements in the array that Perl returns. Read Perl Idioms Explained - @ary = $str =~ m/(stuff)/g and Hits on a reg expression.
  2. Don't even start. That's a futile discussion that goes nowhere.
  3. I'm guessing that you are looking into template solutions, such as Mason and HTML::Template. (I'm sure there are others.)

Did you just post the same questions twice? (a Couple of questions!)

Oh, I see, there's an extra question there. To answer the extra question, you could try something like: /$data\s+(\w+)/ and pick up $1 after the match. But really, you should read ISBN 0596002890 and a myriad of other questions on regular expressions.