Tomte has asked for the wisdom of the Perl Monks concerning the following question:
In a utility-module I have the folling snippet (it's a slightly extended utils.pm of the nagios-distribution):
%ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=> +4); %ERROR_TEXT= map { $ERRORS{$_} => $_ } keys %ERRORS;
Is there a more concise way to 'reverse' a hash?
regards,
tomte
Hlade's Law:
If you have a difficult task, give it to a lazy person --
they will find an easier way to do it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: 'reversing' a hash (reverse)
by particle (Vicar) on Jun 18, 2003 at 17:02 UTC | |
|
Re: 'reversing' a hash
by dws (Chancellor) on Jun 18, 2003 at 17:05 UTC | |
|
Re: 'reversing' a hash
by shotgunefx (Parson) on Jun 18, 2003 at 21:46 UTC | |
|
Re: 'reversing' a hash
by BrowserUk (Patriarch) on Jun 18, 2003 at 22:10 UTC | |
by Tomte (Priest) on Jun 19, 2003 at 12:01 UTC | |
by BrowserUk (Patriarch) on Jun 19, 2003 at 12:15 UTC | |
|
Re: 'reversing' a hash
by Tomte (Priest) on Jun 18, 2003 at 17:06 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |