Hi Perl Monks, I am getting some values from database by querying. This data contains, 4 fields namely, Application Name, Date, Location, Average Response Time. This four fields will have multiple records.

Sample Data :

Application Name -Date -Location -AverageResponseTime

SMS3 -01/01/2012 -San Jose -2.24

SMS3 -01/02/2012 -San Jose -2.31

SMS3 -01/03/2012 -San Jose -2.43

SMS3 -01/01/2012 -New York -2.25

SMS3 -01/02/2012 -New York -2.13

SMS3 -01/03/2012 -New York -2.91

In iterations till the records are over I am getting one row of data into and array.

 while ( my @row = $sth->fetchrow_array( )

I want to get this array into hash map and then convert the fields like, Date, San Jose,New York ,... and its corresponding average response times as other rows

Data should become in format like :

Date -San Jose -New York

01/01/2012 -2.24 -2.25

01/02/2012 -2.31 -2.13

01/03/2012 -2.43 -2.91

Can you please help me to use hashmap for this

Thanks, Vidya Surendran


In reply to Hash map in perl/tk by vsurend

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.