I want to read in this file, split each line on the ":", and store the values in a hash like ...IMNSearch.msg.en_US.rte.com:IMNSearch.msg.en_US.rte.com:2.4.0.0: : :C: + :Text Search Messages - U.S. English: : : : : : :1:0: IMNSearch.rte:IMNSearch.rte.com:2.4.0.0: : :C: :Text Search Client/Ser +ver Shared Files : : : : : : :1:0: IMNSearch.rte.httpdlite:IMNSearch.rte.httpdlite:2.1.0.0: : :C: :Lite N +etQuestion Local Web Server: : : : : : :1:0:
I think I've got this part working fine; the problem comes in when I try to print the output. What I wind up with is ...$data{"foo"}{IMNSearch.msg.en_US.rte.com} = 2.4.0.0
Here is what I've got ...IMNSearch.msg.en_US.rte.com IMNSearch.msg.en_US.rte.com IMNSearch.rte IMNSearch.rte IMNSearch.rte.httpdlite IMNSearch.rte.httpdlite
Am I missing something obvious, or doing something dumb (or both?)my (%data, $system, @fields); $system = "foo"; open (FILE, "$system"); while (<FILE>) { @fields = split (/:/, $_); $data{$system}{$fields[$1]} = $fields[$2]; }; close FILE; foreach (sort keys %{$data{$system}}) { printf ("%-30s%-30s\n", $_, $data{$system}{$_}); };
In reply to Help with printing values from a hash of hashes by blueflashlight
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |