title: Differences beteween switch- and if-statements
body: <p>Do these two statements behave equally or could they yield different results?</p>
  
  <pre><code>if ( ... ) {...}
  elsif( ... ) {... }
  elsif( ... ) { ... }
  else { ... }
  </code></pre>
  
  <p>.</p>
  
  <pre><code>given ( ... ) {
      when ( ... ) { ... }
      when ( ... ) { ... }
      default { ... }
  }
  </code></pre>
  
  <p>I've found the problem - with a modified ninth "when" it works now.</p>
  
  <pre><code>...
  no warnings qw(numeric);
  my $c = &amp;getch();
  
  given ( $c ) {
  when ( $c == $KEY_LEFT and 1 &gt; 0 ) { say 1; say $c }
  when ( $c == $KEY_RIGHT ) { say 2; say $c } 
  when ( $c eq "\cH" or $c eq "\c?" ) { say 3; say $c } 
  when ( $c eq "\cC" ) { say 4; say $c } 
  when ( $c eq "\cX" or $c eq "\cD" ) { say 5; say $c } 
  when ( $c eq "\cA" ) { say 6; say $c } 
  when ( $c eq "\cE" ) { say 7; say $c } 
  when ( $c eq "\cL" ) { say 8; say $c } 
  when ( not( not $SpecialKey{$c} ) ) { say 9; say $c } 
  when ( ord( $c ) &gt;= 32 ) { say 10; say $c } 
  default { say 11; say $c }
  }
  
  if ( $c == $KEY_LEFT and 1 &gt; 0 ) { say 1; say $c }
  elsif ( $c == $KEY_RIGHT ) { say 2; say $c } 
  elsif ( $c eq "\cH" or $c eq "\c?" ) { say 3; say $c } 
  elsif ( $c eq "\cC" ) { say 4; say $c } 
  elsif ( $c eq "\cX" or $c eq "\cD" ) { say 5; say $c } 
  elsif ( $c eq "\cA" ) { say 6; say $c } 
  elsif ( $c eq "\cE" ) { say 7; say $c } 
  elsif ( $c eq "\cL" ) { say 8; say $c } 
  elsif ( $SpecialKey{$c} ) { say 9; say $c } 
  elsif ( ord( $c ) &gt;= 32 ) { say 10; say $c } 
  else { say 11; say $c }
  
  close TTYIN;
  </code></pre>