The xml file is
<?xml version="1.0" encoding="UTF-8"?>
<dataroot>
<data>
<ID>1</ID>
<Field1>Column 1</Field1>
<Field2>Column 2</Field2>
<Field3>Column 3</Field3>
<Field4>Column 4</Field4>
</data>
<data>
<ID>2</ID>
<Field1>Column 1</Field1>
<Field2>Column 2</Field2>
<Field3>Column 3</Field3>
<Field4>Column 4</Field4>
</data>
</dataroot>

And the Code so far is

use strict;
use warnings;

use XML::Simple;

my $data = XMLin('data.xml', forcearray=>1);

for my $data (@{$data->{data}})
  {
    foreach (qw(Field4))
      {
        print $data->{$_}->[0], "\n";
      }
    if ($data{"Field4"} eq "Column 4")
      {
        print "match = ", $data->{$_}->[0], "\n";
      }
  }


Which isn't working but giving me errors.

My ultimate goal is to be to examine text within each Field.  What has been
missing in all of the write ups I've seen is how to get to identify an
individual field and get access to the text contained in it.  Can I set a
variable equal to the text? Or how do I test for a match against the text?


Thanks,
Bruce Bowen


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to