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;