At 3:33 AM +0530 4/9/12, S Pratap Singh wrote:
Hi ,
I have few files which contains user name and data transfer rate in MBs and
this data is collected for year and for each month report is saved in 12
different files I have to merge all the files to prepare the final report
Files are as below
First, write a program that successfully opens and reads all of the
files. Derive the month from the file name or the file name from the
month, if they are not the same, as you will need both. Assign the
month name to a variable, e.g., $month.
Read the files, one line at a time. Identify the lines that have data
in them. Extract the user name into one variable, e.g., $user, and
the data transferred into another variable, e.g. $transferred.
Store the data in a hash-of-hashes, e.g. %data_transferred, this way:
$data_transferred{$user}{$month} = $transferred;
When you have read all of the files, you can iterate through the hash
and print your report. If an entry does not exist, print "Not
available"
If you get stuck, post your program here and someone will be able to help you.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/