iphone has asked for the wisdom of the Perl Monks concerning the following question:
I have a hash %Hash whose keys are names of xml files and values are an array of line/lines present in the xml files.Now i want to print the data of the hash in such a way that only the "keys that have a value" needs to be printed.
For example OUTPUT of my code is as follows
I want the output to be likeacer.xml' => [], tools.xml' => [], files.xml' => [ 'organize/file/load.c#6''embark/fi +les/data.c#4' ], multimedia.xml' => [],
I tried to use the below code but the values are getting printed as array references and all the keys and values are getting printed.Please helpKEYS:files.xml Values:organize/files/load.c#6 embark/files/data.c#4
foreach my $key ( keys %Hash ) { my $value = $Hash{$key}; print "KEYS:$key VALUES:$value\n"; }
|
|---|