|No such thing as a small change|
re-useing a hashby ministry (Scribe)
|on Apr 20, 2005 at 15:43 UTC||Need Help??|
ministry has asked for the wisdom of the Perl Monks concerning the following question:
my issue today is with re-initializing a hash. in the following code (i posted it all, to help minimize the confusion) i use a hash as a counter for every instance i run into a specific pattern match. in this code i look through a firewall config file, and the same firewalls logfile for rule numbers. the config file will yield a result of all rules listed on the firewall, while the logfile search will result in a total count of each rule that it has found.
with this being the only way i know how to increment a count of undefined items, i have not found a way to properly clear this hash before assigning it to the task of searching through my next firewalls config/log file. in searching the web, the only item i have found is the use of %hash=() however this will not eleminate each key/value pair from my hash.
any help or advice (aside from suggesting i re-write the entire code) would be greatly appreciated.
Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement.