title: Need to add prefix to captured names, based on given lists
body: <p>I have two arrays @Mister and @Mrs and need to add prefix based on the   values.</p>
  
  <pre><code>@Mister = qw(Parasuram Raghavan Srivatsan);
  @Mrs = qw(Kalai Padmini Maha);
  
  my $str = "I was invited the doctor Parasuram and Kalai and civil Engineer Raghavan and Padmini and finally Advocate Srivatsan and Maha";
  
  #Mr. Parasuram Mr. Raghavan Mr. Srivatsan
  if(grep ($_ eq $str), @Mister)
  { $str=~s/($_)/Mr. $1/g; }
  
  #Mrs. Kalai Mrs. Padmini Mrs. Maha` 
  if(grep ($_ eq $str), @Mrs)
  { $str=~s/($_)/Mrs. $1/g; }
  </code></pre>
  
  <p>Output Should be:</p>
  
  <p><code>I was invited the doctor Mr. Parasuram and Mrs. Kalai and civil Engineer Mr. Raghavan and Mrs. Padmini and finally Advocate Mr. Srivatsan and Mrs. Maha</code></p>
  
  <p>Could someone simplify the way I am doing and whats wrong in this code.</p>