I am doing questions from different sites. I came accross this one, not sure how to go about it
There are 2 csv files that have following information
File 1:
| Application |
Memory (GB) |
Language |
| App1 |
4 |
Perl |
| App2 |
8 |
Java |
| App3 |
8 |
Java |
| App4 |
4 |
PHP |
| App5 |
8 |
C# |
File 2:
| Application |
CPU |
Cores |
| App1 |
1.5 |
2 |
| App2 |
2.5 |
4 |
| App3 |
2.8 |
4 |
| App4 |
2.8 |
2 |
| App5 |
2.8 |
2 |
Need to print name of apps that have CPU value 2, sorted by their memory size
e.g App1, App4 and App5
I was thinking of using nested hash to read the file elements
my %apps;
$apps{"App1"}{Memory} = 4;
$apps{"App1"}{Language} = 'Perl';
$apps{"App1"}{CPU} = '1.4';
$apps{"App1"}{Cores} = '2';
.... So on. Is this the right way to read file into nested hash ?
Not able to wrap my head around the problem
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.