I a lot of data from which I am trying to extract information. The data is pretty well ordered, so this shouldnt be a problem. I dont have the ability to install any packages, sadly, so this is made slightly more complicated. here is a sample of my code
my $name = '';
if($x =~ /<name>(.*?)<\/name>/igs)
{
$name = $1;
}
my $time = '';
if($x =~ /<published>(.*?)<\/published>/igs)
{
$time = $1;
}
my $content = '';
if($x =~ /<content type='text'>(.*?)<\/content
+>/igs)
{
$content = $1;
$content =~ s/\n/ /ig;
}
print "$id\t$name\t$time\t$content\n";
here is an example of the data to be parsed:
<id>http://gdata.youtube.com/feeds/api/videos/5InqyMvRZ8o/comments/730
+7D6E7F6E2D1B8
</id>
<published>2007-04-05T12:05:42.000-07:00
</published>
<updated>2007-04-05T12:05:42.000-07:00
</updated>
<category scheme='http://schemas.google.com/g/2005#kind' term='http://
+gdata.youtube.com/schemas/2007#comment'/>
<title type='text'>Fantastisk video,, ...
</title>
Keep up the good work. - jeg glæder mig meget til at se flere video
+er fra dig..uper billeder du har fundet (:
</content>
<link rel='related' type='application/atom+xml' href='http://gdata.you
+tube.com/feeds/api/videos/5InqyMvRZ8o'/>
<link rel='alternate' type='text/html' href='http://www.youtube.com/wa
+tch?v=5InqyMvRZ8o'/>
<link rel='self' type='application/atom+xml' href='http://gdata.youtub
+e.com/feeds/api/videos/5InqyMvRZ8o/comments/7307D6E7F6E2D1B8'/>
<author>
<name>cajaneil
</name>
<uri>http://gdata.youtube.com/feeds/api/users/cajaneil
</uri>
</author>
for some reason, my regular expressions aren't matching any field except for content. any idea what the problem is?