in reply to Matching multiple substrings of a string to arrays and printing those that match
Your dis and apr arrays only have one element each in them, corresponding to the last line of each file. You should push into each array. For example, change:
@dis_dic = $f1_line;
to:
push @dis_dic, $f1_line;
Also, your use of index looks strange. Re-read the docs. You could use grep there. But, I think using hashes is better than arrays in this case.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Matching multiple substrings of a string to arrays and printing those that match
by mr_ron (Chaplain) on Apr 03, 2018 at 21:24 UTC |
In Section
Seekers of Perl Wisdom