%hash{'key1'}{'key2'}='string'
I need to find key2 when string eq $1 from a previous regex. I would like to avoid another foreach because this hash can have over 1000 key1's and it is already nested inside 4 foreach loops.
That said, any solution is welcome, even with the foreach loops.
I have experimented a bit with grep but it seems to only work on arrays. I also had an idea to print the hash into a long string and then regex or grep it but it never led anywhere.
Update: my hash is 1:1 and I use this structure extensively and need to do this lookup just once. Using the reverse function did exactly what I needed. Thanks all.
In reply to fast hash search by ddoc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |