title: If condition not matching inside a foreach loop in perl
body: <p>I'm trying to match a string with if statement inside a foreach loop but its not matching although i get the same string with printed before if statement inside foreach loop. Please help.</p>
  
  <pre><code>use Net::Telnet;
  $ip='xx.xxx.xx.xx';
  $ip_port='10002';
  $port  = new Net::Telnet-&gt;new( Host=&gt;$ip,Port=&gt;$ip_port,Dump_log=&gt; "dump.log");
  
  my @folder= $port-&gt;cmd("ls");
  sleep(2);
  
  $folders=@folder;
  print "Number of folders are:$folders\n";
  
  foreach my $folder(@folder)
  {
          print "Folder before if is:$folder\n";
          if(($folder eq "acc") || ($folder eq "bda"))
      {
  
         # some code here.
      }
  }
  </code></pre>