我正在尝试将字符串与 foreach 循环内的 if 语句匹配,但它不匹配,尽管我在 foreach 循环内的 if 语句之前打印了相同的字符串。请帮忙。
use Net::Telnet;
$ip='xx.xxx.xx.xx';
$ip_port='10002';
$port = new Net::Telnet->new( Host=>$ip,Port=>$ip_port,Dump_log=> "dump.log");
my @folder= $port->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.
}
}