http://www.perlmonks.org?node_id=39498

ImpalaSS has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Im sure this is a stupid question, but i cant figure out how to make it happen. Again, i stress this is not homework, but a requirement at my job. Anyways, here goes. I have an array, in it is 3 values, long ones. WHen i go to incorporate this array into my code, the output automatically goes to the next line after the value in the array, and hence messes up the output. Here is the normal output :
                      RF Block | DCCH Block | Disp Queue | RF Drop | Erl/BR |
DE-NJ-MD sites          1.40 % |    0.24 %  |    1.39%   |   2.04% |   2.35 |
PA Sites Only           1.68 % |    0.32 %  |    1.79%   |   2.09% |   2.53 |
Philadelphia Market     1.58 % |    0.29 %  |    1.65%   |   2.07% |   2.46 |
and here is the output with the array added. (i want to add the dates at the end of each row, corresponding to when the data was collected)
                      RF Block | DCCH Block | Disp Queue | RF Drop | Erl/BR |
DE-NJ-MD sites          1.40 % |    0.24 %  |    1.39%   |   2.04% |   2.35 |
 Fri Oct 13 2000 20:11:54                                              Page  1
PA Sites Only           1.68 % |    0.32 %  |    1.79%   |   2.09% |   2.53 |
 Fri Oct 13 2000 20:51:41                                              Page  1
Philadelphia Market     1.58 % |    0.29 %  |    1.65%   |   2.07% |   2.46 |
 Fri Oct 13 2000 20:59:56                                              Page  1
ir gets all fouled up. Im sure the code will be helpful, so here that is.
Note: the date array is entitled @indidate
#!/usr/local/bin/perl use strict; # Author: Dipul Patel # Nextel Philadelphia # This script takes the data for 3 markets, and compiles it on one fi +le. ###########################################33 my $time2 = scalar localtime(); my @time3 = split(/ /, $time2); my $one=$time3[1]; my $two=$time3[3]; my $three=$time3[5]; my $fileext = "$one" ."_". "$two" ."_". "$three"; open(WR, ">/usr/local/rf-north/WWW/WeeklyReports/WeeklyReports.$fileex +t"); my @files = ("/usr/local/rf-north/WWW/PHLreports/cellsight/Weekly_Repo +rts/de-nj-md\n", "/usr/local/rf-north/WWW/PHLreports/cellsight/Weekly_Reports/ +pa_only\n", "/usr/local/rf-north/WWW/PHLreports/cellsight/Weekly_Reports/ +phila_market\n"); my $file; my (@data, @lines); for $file (@files){ open (FH, $file) || die "Unable to open file $file\n"; @data = <FH>; close (FH); push (@indidate, $data[1]); push (@lines, $data[$#data]); } my $i=0; my @string =("DE-NJ-MD sites ", "PA Sites Only ", "Philadelphia Market "); printf(WR " RF Block | DCCH Block | Disp +Queue | RF Drop | Erl/BR |\n"); while($i<3){ my $line=$string[$i].@lines[$i].$indidate[$i]; printf(WR "$line"); $i++; } close (WR); undef @data;
as soon as i remove the $indidate[$i] tag, the output prints correctly, but it is essential that i have the dates there. Is there a way to remove everything except the date from each value in the array? Or to make sure there is no carriage return after the |?
Thank You
Dipul Patel