in reply to Parsing an xml file

The code below does the job with a VERY CRUDE parser - this may be enough to get you started, but I certainly would not recommend it if the "XML" you expect to parse varies in syntax, even slightly.
use strict; use warnings; use Getopt::Long; use File::Glob (); my %options=(); GetOptions (\%options,'loc=s'); my $contents_xml = glob(($options{loc} . '\\contents.xml')); open my $f, "<", $contents_xml or die "Cannot open $contents_xml:$!"; while (<$f>){ m/=\s*"([^"]+)"[^\/]*?>([^<]+)/ and print "$1 $2\n"; } close $f;
Again - this code makes many assumptions on the syntax AND formatting of the incoming "XML".

            "XML is like violence: if it doesn't solve your problem, use more."