Hi,
Though this is a simple problem, I am literally confused to proceed this further. I have got a list of names with their priority something like this:
1 Flu
1 Cold
2 Diabetics
3 Typhoid
4 Measle
It has more than 15 such names. And is not from any file or any thing. I can initialize them in the code. And the numbers are the priority for each of the names. The priority may be same for different names. What I actually have to do is to query from the database for these names by their Identifiers(not the priority number) and write the result to a file.
And when writing the output the result should be in the priority order. I am really confused, If using a hash I cant have the integers as a 'key' since there may be repetitive of priority number as in the example.
Where as I am not sure of the way to initialize the array with both the priority number and the name associated to each other. I have a working code that fetches from the database for these name with the priority.( have used hash here with 'key' as name and 'value' as priority) But not in the given order mentioned above.
Also, as the SQL query fetches from the database in anyorder its printing in the order that it fetches from the database with the priority number as 'qouted in the hash'.
Any suggestions on this guys? Thank for your time and suggestions.
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.