in reply to Re: How to concatenate a generic array of arrays and an array of hashes
in thread How to concatenate a generic array of arrays and an array of hashes

Hello Christoforo,

Thanks for your time and effort to reply to my question. Well unfortunately this is not exactly what I want to do. My current solution is exactly what I want.

Sample of output using 2 dimension arrays:

$VAR1 = [ [ 'Line_1_3', 'Line_2_3' ], [ 'Line_3_3' ], [ 'Line_4_3', 'Line_5_3', 'Line_6_3', 'Line_7_3' ] ];

Sample of array with hashes:

$VAR1 = { 'sample.txt' => [ 'Line_1_3', 'Line_2_3' ], 'sample_2.txt' => [ 'Line_3_3' ], 'sample_3.txt' => [ 'Line_4_3', 'Line_5_3', 'Line_6_3', 'Line_7_3' ] };

The reason is that possibly the files are not the same in line (size) etc. etc. I am trying to retrieve the arrays one by one so I can play around with it.

I have found a way to print all data and also to print individual 1 by one the elements but not the arrays. I have an idea in my mind on how to solve it. I did not had the time to work on it, that is the reason that I have not updated my solution.

But thanks again for your time and effort and sorry if my sketch is not so clear.

Seeking for Perl wisdom...on the process...not there...yet!

Replies are listed 'Best First'.
Re^3: How to concatenate a generic array of arrays and an array of hashes
by Cristoforo (Curate) on Jul 06, 2014 at 23:17 UTC
    Each file contains data, I import the data on arrays then I short them on array of arrays
    I don't know what exactly you wish to do - do you mean sort?

    If you want to sort them, how would your output appear?

    You stated your solution is what you want.

    I have found a way to print all data and also to print individual 1 by one the elements but not the arrays.
    I don't know what you mean in the statement above. How do you want to print the arrays?

      Hello Cristoforo,

      I am trying to read n number of *.txt files as argument inputs. Each file contains infinite n number of lines in the file. I want to extract the the 4th element of each line. Each element of each line is separated with a column ":".

      Line example:

      Line_1:Line_1_1:Line_1_2:Line_1_3:Line_1_4

      After collecting each element from each line I want to put them on an array so I am able to manipulate the values of each element.

      The reason that I am using array of arrays is that I do not know the number of *.txt files that I am going to use.

      As a second step I am trying to print the collected values based on order of the files separated with a space in between.

      Sample of the expected output:

      Line_1_3 Line_3_3 Line_4_3 Line_2_3 Line_5_3 Line_6_3 Line_7_3

      Each column represents the *.txt file that was loaded. For example if we had loaded the sample.txt it would be column 1, sample_2.txt would be column 2 and sample_3.txt would be column 3.

      I hope this explains more and produces less confusion.

      Thanks for your time and effort to assist me.

      Seeking for Perl wisdom...on the process...not there...yet!