I have an hash of keys and values as below. Each key has multiple values, but each value could reference a key.
For a given input key, I need to print the values, and if the value is also a key, then print the value of that key in
brackets as below:
Input : Usb1
Input : Usb2
The logic I tried is to first check if the input key exists in the hash then load the values of that key into an array
Now, iterate through the array, print $_ , then compare if the value matches any key in the hash, if matches, print the value.
But now, I dont get how long and how I can keep doing this, because the set of keys could reference another key and so on...
Any suggestions or examples could help. Thankyou