topical media & game development

talk show tell print

professional-xml-17-perl-iteratecustomers.pl / pl



  use XML::Simple;
  
  my file = 'customers.xml';
  
  my doc = XMLin(file, KeyAttr=>[]);
  
  # Iterate over all customers
  print "Iterate over all customers";
  foreach cust (@{doc->{customer})
  {
          print cust->{company}, "\n";
          print cust->{address}->{street}, "\n";
          print cust->{address}->{city}, , ", ", cust->{address}->{country}, "\n";
          print "\n";
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.