title: perl exact string match
body: <p>I have following Perl code to prompt user for yes/no answer. If the user enters anything else than yes/no, keep prompting. No other word is acceptable. I don't know why this code doesn't work. I tested with answer "noooooo" and I was expecting it to prompt again but it does not enter the while loop.</p>
  
  <p>Can anyone help find my mistake here?</p>
  
  <pre><code>@files = A, B, C;
  
  foreach $c (@files) {
    if (-e $c  ) { 
       print " $c already exists. Do you want to overwrite?  (yes or no): ";
       chomp ($file_yes_no = &lt;STDIN&gt;);
  
       while ($file_yes_no !~ m/yes{1}|no{1}/i )  {
           print "$c already exists. Do you want to overwrite?  (yes or no): ";
           chomp ($file_yes_no = &lt;STDIN&gt;);
       }
  
       if ($file_yes_no =~ m/yes/i ) {
           if (system ("cp -f /home/old_path/ /home/new_path/ == 0) {
               print "$c successfully copied;
           } else {
               die "Error: Copy failed, Check the message above";
           }
       }
   else { print "No files copied\n; }
  </code></pre>