in reply to Counting devices types, device sizes and number of devices.
Dear perl514,
sounds like you got a good concept of solving your problem. Please add your sourcecode to the questions if possible for better help.
I'd walk through the lines using while (<$fh>) and split each line at \t which returns an array of each line's information.
Understanding might be easier if you print out the split result array using join or Data::Dumper until your script is working.
If all you need is this output, you may use a trick to avoid using references (which isn't that easy for Perl beginners) by using a hash and the full text part ("Total Number of $split_result[4] Devices of $split_result[7]MB") as the key. The "++" operator easily adds one for each device found matching that key.
The conversion of MB's to other units may be done using a if/elsif/else block or a CPAN module like Format::Human::Bytes.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Counting devices types, device sizes and number of devices.
by perl514 (Pilgrim) on Jan 03, 2012 at 07:36 UTC | |
by Sewi (Friar) on Jan 03, 2012 at 20:03 UTC | |
by Marshall (Canon) on Jan 06, 2012 at 17:26 UTC |