in reply to Is this the correct structure?
use strict; use warnings; my @AoA; while(<STREAM>){ chomp; next if (/METHOD/); push @AoA, [split /\s+/]; } print \@AoA; __DATA__ METHOD 0TM 1TM 2TM >2TM method1 3 68 18 10 method2 3 80 10 6 method3 3 87 9 1 method4 5 83 9 3 method5 6 75 15 4 method6 14 77 6 3 method7 12 82 2 3 method8 9 84 3 3 method9 13 68 16 3 method10 5 65 20 9 method11 9 64 20 7 method12 5 68 18 9 method13 6 82 9 2 method14 11 79 8 2 method15 6 69 20 5 method16 5 80 11 3 method17 1 68 17 14
What happens here is, the split "tokenizes" each line assuming the space between the words as the delimiter. The square brackets around the split create a reference to an anonymous array which is pushed into the array of arrays data structure.
UPDATEUmm 2teez already said what I wrote above... I did not check the replies before posting... mesa bad.
|
|---|