in reply to Re: Foreach Complications
in thread Foreach Complications
Now, the only problem is that $cellname isnt printing correctly. This is what i should get as the titles: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;
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
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 20040 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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Foreach Complications
by arturo (Vicar) on Dec 07, 2000 at 20:16 UTC | |
by dws (Chancellor) on Dec 07, 2000 at 22:29 UTC | |
|
Re: Re: Re: Foreach Complications
by kilinrax (Deacon) on Dec 07, 2000 at 20:31 UTC | |
by jeffa (Bishop) on Dec 07, 2000 at 22:18 UTC |