Problems? Is your data what you think it is? | |
PerlMonks |
hash arrayby roadtest (Sexton) |
on Nov 03, 2010 at 17:15 UTC ( [id://869279]=perlquestion: print w/replies, xml ) | Need Help?? |
roadtest has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to use hash array to calculate the running time of each cron job. The log file likes following:
The leading character "<" means job started, ">" means job finished. The second field is username. Third field is jobID, which might be reused after this one is done. Since all these are daily jobs, I only care field 8 to calculate run time. Here is what I am trying to do: ==start code== ==end code here== There are three problems with my code: 1. under "strict" mode, it doesn't allow me to use number(jobID in my case) as ARRAY ref. 2. didn't consider same jobID may appeared later 3. It seems "${$owner}{$job_id}" is treated as array reference instead of hash array. When I debug above code, this variable is always null. Seek a better approach to achieve the target. Thanks in advance!
Back to
Seekers of Perl Wisdom
|
|