I am trying to find out how to dump arrayB into arrayA as the (new) last element. Kind of like push(), except that rather than adding the elements of arrayB at the end of arrayA as several more elements, you get all of arrayB as the last element of arrayA.
A short (and simplified) explanation of what I'm trying to do:
User supplies a filename, which contains a variable number of text blocks. User then supplies a variable number of strings. Each block of text is read in, piecemeal, and searched for each string. Each pass through saves the position of each match to a string into an array (arrayB). This array of matches to the first string becomes the first element of arrayA. The search is repeated for the second string (a new arrayB), and this array becomes the second element of arrayA, and so on for the number of strings the user desires. Once the first text block has been thoroughly search, arrayA now gets dumped into the first element of arrayC. Then, we progress on to the second text block, and so on from there.
Ideally, I would then format each text block to highlight each string-match in a particular color, based on the position of hits stored in each ArrayB, corresponding to the particular string matched stored in each ArrayA, corresponding to the text block the hits are found in (the position in ArrayC.
So, the length of ArrayC is a variable dictated by the contents of a user input file, the length of each element of ArrayC is ArrayA, which is dictated by the number of strings to be searched for, again dictated by the user, and the position of each of the matches to each string is uncovered by m//, and stored in ArrayB
I hope that makes sense to someone other than me.
Any advice would be greatly appreciated.
TIA,
Matt
In reply to appending and array into last element of an array? by mdunnbass
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |