The subroutine is rather lengthy, so let me just post the relevant parts:
sub PRINT_INFO {
my ($netid, $sitename, $sector) = @_;
$DAILY_HEAD= "Date Total";
$,="\t"; #Output Field Separator
$query_string="netid=$netid-$sitename-$sector&report_type=Daily+Totals
+&market=PHL";
$query_string =~ s/[=&]/ /g;
@query_string=split(' ', $query_string);
$network_element=$query_string[1];
$report_type=$query_string[3];
$MARKET=$query_string[5];
@network_element=split(/-/, $network_element);
$id=$network_element[0];
$name=$network_element[1];
$sector=$network_element[2];
######################################################
$DAILY_PATH="/data1/$MARKET/reports";
$BUSY_PATH="/data1/$MARKET/bhreports";
$PKD_PATH="/data1/$MARKET/pkdreports";
$MISC_PATH="/data1/$MARKET/miscreports";
$MDG_PATH="/data1/$MARKET/mdgreports";
$cellname="$network_element[1] Sector $network_element[2]";
$search_string="\Q($id)";
print "$cellname\n";
@all_readable_files=grep !/\.Z/, `ls -t $DAILY_PATH | head -95`;
#@all_readable_files=grep !/\.Z/, `ls -t $DAILY_PATH`;
print "$DAILY_HEAD\n";
foreach $file(@all_readable_files) {
chomp($file);
@date = split /_/, $file;
$date = $date[0];
open(FILE, "$DAILY_PATH/$file");
@DATA=<FILE>;
@result = grep /$search_string/, @DATA;
$hits = grep /$search_string/, @DATA;
for ( $i = 0; $i < $hits; $i++ ) {
@_=split(' ', $result[$i]);
chomp @_;
print $date[0],$_[7];
print "\n";
}
close FILE;
Now, the only problem is that $cellname isnt printing correctly.
This is what i should get as the titles:
0040 Sector 1
0040 Sector 2
5228 Sector 1
5228 Sector 2
5458 Sector 1
0473 Sector 3
5335 Sector 1
5335 Sector 2
0267 Sector 3
0314 Sector 1
0314 Sector 3
5268 Sector 1
5268 Sector 2
This is what i do get
0040 Sector 1
5228 Sector 1
5228 Sector 1
5228 Sector 1
5228 Sector 1
5228 Sector 1
5228 Sector 1
5228 Sector 1
5228 Sector 1
5228 Sector 1
0040 Sector 2
0040 Sector 2
0040 Sector 2
I know the netid's that the sunroutine gets are being processed correctly, its the titles that are causing the problems.
0040 Sector 1
0040 Sector 2
5228 Sector 1
5228 Sector 2
5458 Sector 1
0473 Sector 3
5335 Sector 1
5335 Sector 2
0267 Sector 3
0314 Sector 1
0314 Sector 3
5268 Sector 1
5268 Sector 2
Kilinrax - I also did try a for loop, but it took forever to run. this one takes about 2 mins, the other.. i dont even it remember finishing.
arturo - to answer your question: the $index was used for the forloop, i just forgot to delete it, thanks much.
I hope this helps.
Dipul |