|
input text from file into 2d array
Hi all
I have a little brainscratcher here.
I want to draw a pie chart from data in a text file.
The drawing of the graph works fine, if I insert the data manually into a 2d array.
Now I want to pull the data from a text file (which was created using a uniq -c command) see sample below.
Code:
1 012lg.pwv.gov.za
1 0zero1.co.za
1 123websites.co.za
1 3gi.co.za
1 3rivers.net
12 3smedia.co.za
1 4data.co.za
3 4seasons4u.co.za
1 aability.co.za
2 aapg.org
1 aapt.net.au
Now the thing that I would like to know. is it possible to change that data into something like a 2d array as seen below
Code:
my @data = (['Project', 'HW1', 'HW2', 'HW3', 'MidTerm', 'Final'],
[25, 6, 7, 2, 25, 35]);
I would prefer if it was in perl, as the graphing is done in perl.
Thank you in advance
|