title: In Perl, how can I test if a string is a palindrome?
body: <p>I'm attempting to write a Perl program to determine if a 7 character user input is a palindrome. </p>
  
  <p>Without using any array, string, or reverse functions. </p>
  
  <p>Desired output:</p>
  
  <pre><code>    Enter in a 7 character item: 1111111
      PALINDROME!
  </code></pre>
  
  <p>Or </p>
  
  <pre><code>    Enter in a 7 character item: 1234567
      NOT A PALINDROME!
  </code></pre>
  
  <p>This is what I have so far:</p>
  
  <pre><code>print "Enter in a 7 character item: \n";
  my ($a, $b, $c, $d, $e, $f, $g);
  chomp ($a=&lt;&gt;); chomp ($b=&lt;&gt;); chomp ($c=&lt;&gt;); chomp ($d=&lt;&gt;);
  chomp ($e=&lt;&gt;); chomp ($f=&lt;&gt;); chomp ($g=&lt;&gt;);
  if ($a~~$g &amp;&amp; $b~~$g &amp;&amp; $c~~$e){
      print "PALINDROME!\n";
  }
  else{
      print "NOT A PALINDROME! \n";
  }
  </code></pre>
  
  <p>Unfortunately, this is giving me this result:</p>
  
  <pre><code>    Enter in a 7 character item:
      1
      1
      1
      1
      1
      1
      1
      PALINDROME!
  </code></pre>
  
  <p>If anyone has suggestions, that would be greatly appreciated.</p>
  
  <p>I look forward to hearing your input. Thank you!</p>