I'm trying to read a config file that will have something like the following information:
Product1 property=value property2=value Product2 feature1 property=value property2=value feature2 property3=value Product3 feature1 property=value property2=value
I need to read this file in and display it in a Perl Tk project. I'm just having a hard time figuring out how to keep track of the features because not all products have features.
@file = <IN>; foreach(@file){ if (/^TSS/){ # All product begin with TSS # Its a product }elseif ($_ =~ /=/){ # get the property and value using split }else{ # Its a feature??? } } # Should I use something like: $hash{$product}{$feature}{$property} = "value"; # or $hash{$product}{$property} = "value"; $hash{$product}{feature} = "feature name"; # if the feature key is her +e, there is a feature. # but how do I keep properties listed after the correct feature!
Obviously some sort of Hash should do the trick but having hard time visualizing it. Any help is appreciated.
In reply to Reading Install type config file into hash by tmurnane
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |