in reply to Re: 'reversing' a hash
in thread 'reversing' a hash
use Data::Dumper; %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=> +4); %ERRORS_TEXT = reverse %ERRORS; print Dumper(\%ERRORS); print Dumper(\%ERRORS_TEXT); __END__ $VAR1 = { 'WARNING' => 1, 'CRITICAL' => 2, 'OK' => 0, 'DEPENDENT' => 4, 'UNKNOWN' => 3 }; $VAR1 = { '1' => 'WARNING', '4' => 'DEPENDENT', '0' => 'OK', '3' => 'UNKNOWN', '2' => 'CRITICAL' };
Get it?
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: Re: Re: 'reversing' a hash
by thealienz1 (Pilgrim) on Jun 18, 2003 at 17:40 UTC |