Hello all,
I have the following code:
@keys contains a list of 3 letter keys from the command line @ARGV. What I am doing is for each key looping through a config file that looks like this:
Based on the key in the from the @ARGV, I want to set the company name for that iteration of the foreach loop in my while loop. It is not working.
This is the output I am gettingform my print statements:
For some reason, it only goes through the while loop the first iteration of the foreach loop. From then on, the three letter key is changed, but the company from the lookup in the while loop does not. As you can see, the second time through the key is "mwd" and from the while loop lookup, the company should then be "Morgan Stanley" but it stays set at "Global Petrolium"
I have been wracking my brain for a hours on this.
Any help is appriciated,
Nick
I have the following code:
Code:
foreach $key(@keys) { #Start main loop
while (<COMP>) {
chomp;
next unless (/$key/);
($junk_key, $company, $exceptions) = split (/,\s*/);
print "key is:$key\tcompany is:$company\texception are:$exceptions\n";
@exceptions = split /\s+/, $exceptions;
print (LOG "Getting ticket counts for $company\n\n");
print (LOG "Starting Peregrine queries\n\n");
#
# Run sub routines. These perform all the queries and a good deal of the query processing.
#
my @clock = ClockQuery($company, \@exception);
my @first_problem = ProbQuery($company, \@exceptions);
my @device = DevQuery($company);
my @problem = ClockProcess(\@clock,\@first_problem);
my @results = FourMonths(@last4months);
}
print "second: key is:$key\tcompany is:$company\texception are:$exceptions\n";
@keys contains a list of 3 letter keys from the command line @ARGV. What I am doing is for each key looping through a config file that looks like this:
Code:
Company Key Company Name Assignment Group Exceptions
coc, CHICAGO,
ccc, IRC COMCAST,
com, CITY OF MINNEAPOLIS,
cpd, CPD,
cta, CTA,
gld, GAYLORD PALMS,
hgi, HARLEYSVILLE,
fya, HEALTH AND HUMAN SERVICES,
ipa, INTERNATIONAL PAPER,
ipi, INTERNATIONAL PAPER,
lal, LEADER,
lmr, LE MERIDIEN,
mmc, MAIMONIDES,
mdc, MIAMI DADE COUNTY,
mwd, MORGAN STANLEY, MWD-T3-SRV MWD-T3-NET
Based on the key in the from the @ARGV, I want to set the company name for that iteration of the foreach loop in my while loop. It is not working.
This is the output I am gettingform my print statements:
Code:
key is:glb company is:GLOBAL PETROLEUM exception are:
Problem company: GLOBAL PETROLEUM
Device company: 1
second: key is:glb company is:GLOBAL PETROLEUM exception are:
second: key is:mwd company is:GLOBAL PETROLEUM exception are:
second: key is:ccc company is:GLOBAL PETROLEUM exception are:
For some reason, it only goes through the while loop the first iteration of the foreach loop. From then on, the three letter key is changed, but the company from the lookup in the while loop does not. As you can see, the second time through the key is "mwd" and from the while loop lookup, the company should then be "Morgan Stanley" but it stays set at "Global Petrolium"
I have been wracking my brain for a hours on this.
Any help is appriciated,
Nick