hey dont expect to be spoon fed every time
ok do this
On Fri, 2002-11-15 at 14:32, Sorin Marti wrote:
> Thanks for answering...
>
> Now the Script runs but it does not print anything out
>
> [print $key." - ".$werte{$key}."\n";]
>
> The script looks like that now...
This should work
>
> #!/usr/bin/perl
> open (FILE, "<test.xml");
> {
> local($/)=undef;
> $text = <FILE>;
> }
while($text=~/<([^\>]+)\>([^<]+)/g) {
$werte{$1} = $2;
}
> foreach $key(keys(%werte))
> {
> print $key." - ".$werte{$key}."\n";
> }
>
> The XML-File has following structure:
>
> <energyuse year='1970'>
> <energy>
> <desc>Oil</desc>
> <value>454570</value>
> </energy>
> .
> . [other data blocks]
> .
> </energiyuse>
>
> What I wanna have is a Hash with key --> value:
>
> desc --> oil
> value --> 454570
>
> The lines with only Tags and no values (e.g. <energy>) I don't need.
>
> Thanks for helping in advance
>
> Sorin
>
--
Ramprasad A Padmanabhan
Sr Software Engineer
Netcore Solns Pvt Ltd
Mumbai
ph - (022) 4628000
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]