in reply to Grouping of 2D arrays

Do you want to group an existing perl array or parse a text file? Could you show us your current code?

Replies are listed 'Best First'.
Re^2: Grouping of 2D arrays
by kfriman (Initiate) on Apr 24, 2017 at 07:17 UTC

    Hi,

    I would like to group a existing perl array. The array is created based on a parsed txt file.

    while (my $row2 = <$fh2>) { chomp $row; my @records2 = split(';', $row2); my @items = ($records2[3], $records2[4], $records2[5], $records2[7], $ +records2[8]);

    I know based on the file the quantity of items, so I have a if statement that knows when all the items are in the array. This if statement should also do the grouping and present the information to the user.

    $colli_amount++; if ($total_colli_amount == $colli_amount) {}
Re^2: Grouping of 2D arrays
by Anonymous Monk on Apr 20, 2017 at 17:08 UTC
    my @array; $array[0] = 1; $array[1] = 'PC BOX'; $array[2] = '20,0'; my @array1; $array1[0] = [ $array[0], $array[1], $array[2] ]; $array[0] = 1; $array[1] = 'PC Spare'; $array[2] = '32,0'; $array1[1] = [ $array[0], $array[1], $array[2] ]; $array[0] = 1; $array[1] = 'PC Spare'; $array[2] = '5,2'; $array1[2] = [ $array[0], $array[1], $array[2] ]; $array[0] = 1; $array[1] = 'PE Ak'; $array[2] = '100,0'; $array1[3] = [ $array[0], $array[1], $array[2] ];