in reply to Re^6: String comparison in an array
in thread String comparison in an array
I have updated the code with few of your commentsThe solution was in the last one though. Your analysis was correct (at least it's part of the issue), the fact that @fillarr contains quotes ("computer" rather than just computer) makes the comparison fail. You should create your $csv object like this: my $csv = Text::CSV->new ({ binary => 1, sep_char => ";" }); (the sep_char part is required). And then replace my (@fillarr) = split ';',$line; by using $csv->parse on $line, and then using $csv->fields.
Also please, replace your first open by open my $types, "<", "types.txt" or die $!; then read with <$types>
And even if the code doesn't work as you want, please make sure that the code you post here at least compiles ;-)
Edit: oh and LanX is right, it would be far easier for us to help you with data (ie, an example of what your two files look like). But that's part of what you need for a short, working example (so again, what hippo asked).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: String comparison in an array
by newperlbie (Acolyte) on Aug 08, 2018 at 14:52 UTC | |
by Eily (Monsignor) on Aug 08, 2018 at 14:57 UTC | |
by newperlbie (Acolyte) on Aug 08, 2018 at 15:03 UTC |