Hello,
I have an XML file that I need to extract data from. The file has multiple lines, one of which contains the following tag:
I need to be able to extract the owner's name from the XML file. I have never programmed Perl before, but I have a pretty strong background in C/C++ and Java. You're probably wondering why the hell I'm jumping into this with no experience in Perl...it wasn't my choice, really. I just started working for a company and the person in charge of the Perl scripts is no longer here, and I just happened to be the only person free enough to take over the project.
I've been doing some research on regular expressions and I found this code:
Apparently, this would print everything between the word "start" and "end". Based on this, would the following code work?
I'm thinking that the / in </Owner> would cause problems...how would that be fixed?
Thanks for your help.
I have an XML file that I need to extract data from. The file has multiple lines, one of which contains the following tag:
Code:
<Owner> owner's name goes here </Owner>
I need to be able to extract the owner's name from the XML file. I have never programmed Perl before, but I have a pretty strong background in C/C++ and Java. You're probably wondering why the hell I'm jumping into this with no experience in Perl...it wasn't my choice, really. I just started working for a company and the person in charge of the Perl scripts is no longer here, and I just happened to be the only person free enough to take over the project.
I've been doing some research on regular expressions and I found this code:
Code:
if($mystring =~ m/start(.*)end/) {
print $1;
}
Apparently, this would print everything between the word "start" and "end". Based on this, would the following code work?
Code:
if($mystring =~ m/<Owner>(.*)</Owner>/) {
print $1;
}
I'm thinking that the / in </Owner> would cause problems...how would that be fixed?
Thanks for your help.