title: Not able to understand !~ in regex
body: <p>My requirement is to pass a string with + (eg: ABC+DEF). And it should match with any value for actual_state, values can be <code>ABC+DEF   ABC+DEF,   ABC+DEF,,</code> etc .Here there can be one or more comma after ABC+DEF. But it should not match with <code>ABC+DEF, PQR-SL</code>.</p>
  
  <p>Below is the code snippet what i tried:</p>
  
  <pre><code>sub verify_state{
       my $expected_state = shift;
       my $vol            = 'vol';
       my $actual_state   = 'ABC+DEF,';
       print "Verify backend state for $vol\n";
       print "Expected backend state for $vol = $expected_state\n";
       print "Actual backend state for $vol = $actual_state\n";
       if ( $expected_state !~ /$actual_state,*$/ ) {
           print
               "Expected state was $expected_state but got $actual_state for $vol\n"
           ;
           return 0;
       }
       return 1;
   }
  
   my $val = verify_state('ABC+DEF');
   print $val,"\n";
  </code></pre>
  
  <p>it should return me 1 if i will pass <code>ABC+DEF</code>.
  0 if i will pass <code>ABC+DEF, PQR-SL</code></p>
  
  <p>why i wrote <code>my $actual_state   = 'ABC+DEF,';</code>
  Because the values <code>ABC+DEF   ABC+DEF,   ABC+DEF,,</code> are coming as a part of a hash value for a specific key eg. <code>my $actual_state   = $status-&gt;{state};</code> .</p>