Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Grouping of 2D arrays

by kroach (Pilgrim)
on Apr 20, 2017 at 09:41 UTC ( #1188381=note: print w/replies, xml ) Need Help??


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] ];

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1188381]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2020-10-20 00:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (208 votes). Check out past polls.

    Notices?