Thanks for all advices and sorry for being an annoyance for the format of my post, :(. i have corrected them now. i'm a newbie in this forum, but try to learn the etiqutte quickly.

thank you for the help, i have made my program working now. it's really cool.

here is part of my code:
#!/usr/bin/perl use warnings; $file =... open (TEMP, $file) or die("Error: cannot open $file\n"); $outfile =... open (OUTPUT,">$outfile"); select(OUTPUT); # explicitly select the new file for output #declare variables $counter_A=0; $counter_B=0; #counter for time of the day $counter_C=2; #counter for day of the week,date starts on + tuesday @interval = (1..35040); #15 mins interval over a year 365 days $nline = "\n"; $scomma = ", "; $i = 0; while ($line = <TEMP>) { @column = split (/,/,$line); @speed = split (/_/,$column[5]); foreach $timeint (@interval) { if ($counter_A==4) { $counter_A = 0; $counter_B++; if ($counter_B==24) {$counter_B = 0; $counter_C++; $i = 0; if (($counter_C>=6) && ($counter_C<8)) { $i = 96; } if ($counter_C==8) { $counter_C = 1; } } } print OUTPUT trim($column[0]).$scomma.trim($column[1]).$scomma.$speed[ +$i].$nline $counter_A++; $i++; } }

the program will read the csv file and place the speed data according to time of the day and day of the week.

i know the code can be more simplified, but it does exactly the job i wanted, also considering i only learned perl for 36 hours, so i'm pretty happy, :-) !

thanks for all PerlMonks, any comments will be welcomed !

In reply to Re^4: How to transform the data with Perl by hujunsimon
in thread How to transform the data with Perl---Solved !!! by hujunsimon

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.