Hello Sorin -

I don't know - I'm too lazy to look hard at your code :)

Why don't you load XML::Simple from CPAN - it can be setup
to do everthing you want!

Aloha => Beau.

-----Original Message-----
From: Sorin Marti [mailto:mas@;semafor.ch]
Sent: Thursday, November 14, 2002 9:52 PM
To: [EMAIL PROTECTED]
Subject: While - Problem 


Hi all,

I,ve got a problem. Following Code reads an Example-String in XML-Style, 
filters out the necessary information and writes it in a HASH. Now I 
want to read a file and not only one String. I thought that I can just 
put a while-loop around my code but that don't work. How may I solve that.


#######################
#!/usr/bin/perl
$text = '<energietraeger>Erdoel</energietraeger> 
<umwandlung>Verbrennung</umwandlung>';
$tmp = $text;
while($tmp =~ /<[^\>]+\>/){
  $tmp =~ s/<([^\>]+)\>([^<]+)<\/[^\>]+\>//;
  $werte{$1} = $2;
}
foreach $key(keys(%werte))
  {
    print $key." - ".$werte{$key}."\n";
  }
#######################

what i get out is:

energietraeger - Erdoel               
umwandlung - Verbrennung      

what I tried:

open (FILE, "<test.xml");
while($text = <FILE>)
{ ##CODE ABOVE## }

then nothing happends

thanks for every advice
Sorin


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to