in reply to Is it right method to use Hash
It depends what you want to achieve. If you want to ensure that you retain only the last set of hosts for each group in the file (assuming there may be multiple lines for the same group) and don't care what order the groups are printed, then yes what you are doing is appropriate. If that is not what you want you better tell us a little more about the problem you are trying to solve.
You could of course try running your code to see if it does what you want. Even better, you could generate a few test data sets and see that you get the results you expect for each data set. If you wrap that testing up in a test script that checks the results then you can regression test your system when you make changes to it or fix bugs.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Is it right method to use Hash
by amg (Initiate) on Jun 13, 2011 at 04:03 UTC |