Perl String Compare fails -


below sample of code:

while (@filelines){   #splice line array    print "the string compared $filelines[$i] $fn_accessories_header\n";    if (chomp($filelines[$i]) eq $fn_accessories_header){     print "the file name fn_accessories.csv , first line header\n";   }   else {     print "the scanning process terminated first line not header\n";     exit;   } } 

the contents of 2 variables same, print in if statement not execute.

asd_bsd;asdf_asdf;weroi_asdf;asdf_asdf;asdf_wer;rty_tyu;sdf_erty;qwe_123;asdffff_asdfrs;

chomp doesn't return shortened string, returns number of characters removed.

chomp @filelines; $line (@filelines) {     if ($line eq $fn_accessories_header) {     ... 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -