in reply to pattern matching from an array to an array of arrays

See First word, which has a similar problem. Maybe you can adapt the answers given there to your problem?

  • Comment on Re: pattern matching from an array to an array of arrays

Replies are listed 'Best First'.
Re^2: pattern matching from an array to an array of arrays
by Anonymous Monk on Oct 22, 2016 at 12:33 UTC

    Yes, thanks. Actually I started from there, the only thing that bugs me is that I am not at all sure if the condition in the if cycle is appropriate. I've looked up on the internet but I can't seem to get a grip on it.

      So, how does your if condition work currently, and what do you want it to do instead?

      Please help us help you better and supply a short, self-contained example that reproduces the problem you encounter. That way, we can more easily see the situation you are in and guide you better to a solution.

      In your case, please add fake input data that makes your problem happen and also describe what should happen instead. Also add enough scaffolding around the code you currently have to declare and initialize all variables.


        Ok. So my starting data look like this:

        1) this is how each array in @AoA is structured

        [someword firstvalue secondvalue ...]

        [otherword first value secondvalue ...]

        [....]


        2) @other_array

        [someword

        otherword

        ...]


        I need to match the words ad align the firstvalue of each array in @AoA to each of the words in @other_array to obtain something like this:

        @other_array

        [someword firstvalueofthefirstarrayin@AoA firstvalueofthesecondarrayin@AoA ...

        otherword firstvalueofthefirstarrayin@AoA firstvalueofthesecondarrayin@AoA ...]


        I thought of rendering @other_array an array of arrays, but I thought that a more economic way to do that would be just to add the values to each string.


        Thanks immensely for your patience