Sorin Marti wrote: > > Hi all, Hello,
> 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; > } my %werte; while ( $text =~ m!<([^>]+)>([^<]+)</\1>!g ) { $werte{$1} = $2; } > foreach $key(keys(%werte)) > { > print $key." - ".$werte{$key}."\n"; > } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]