in reply to Re^7: String comparison in an array
in thread String comparison in an array

Thanks Eily for the explanation.I am going to clean my code. Meanwhile I tried this and it worked....but is this really a bad piece of code?when there is a huge file?
foreach(@keys) { if ( $fillarr1[14] =~ /$_/) { #Found }

Replies are listed 'Best First'.
Re^9: String comparison in an array
by Eily (Monsignor) on Aug 08, 2018 at 14:57 UTC

    It will probably work most of the time. But you will get the wrong result in some cases. For example if $_ is com, and $fillarr1[14] is computer you will get a match even though the two words are not exactly the same. You will also run into trouble if $_ contains special characters.

    There are ways to solve those issues, but the best solution is to not have " inside $fillarr1[14]. Now either you remove them, or you try to understand how Text::CSV works and put the data into @fillarr by using it.

      Good. Thanks again!I will explore Text::CSV