Well I'm actually pulling the data from a database and saved it in the format given in the question then display it on the web, the formatting changed to just MSC_name,count_per_date1...end_date(e.g. 30-JUL-03) for example:

MSC_name,count_per_date1...end_date30(e.g. 30-JUL-03)
MSCBCR1,168,...,170
MSCBCR2,178,...189
Total_cf_produced,346,..,359

The code I'm currently testing is:

#!c:/perl/bin/perl open (INFILE,"c:/playgnd/sql_result_cf.txt") || die("Could not open fi +le!"); while( <INFILE> ) { next if $. == 1; # skip first line chomp; my %F; @F{qw(msc_name chunum date count_per_date)} = split /\s*,\s*/; $Data{$F{date}} = { } unless exists $Data{$F{msc_name}}; $Data{$F{date}}->{$F{msc_name}} = [('')x31] unless ref( $Data{$F{date}}->{$F{msc_name}}); ${$Data{$F{date}}->{$F{msc_name}}}[$F{chunum}] = $F{count_per_date}; } foreach my $date (keys %Data) { foreach my $msc_name (keys %{$Data{$date}}) { print join(",",$msc_name,$date, @{$Data{$date}->{$msc_name}}), "\ +n" ; } } close(INFILE);
Thanks.

In reply to Re: Re: Re: Formating Text file by Anonymous Monk
in thread Formating Text file by redskie007

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.