I am trying to parse a XML file. I download the data from here http://mips.helmholtz-muenchen.de/proj/ppi/
and I use this code but I get error
use strict;
use warnings;
use XML::Twig;
my $MIPS_file = $ARGV[0];
my $xml = XML::Twig->new();
my $data = $xml->XMLin("$MIPS_file");
my $intList = $data->{'entry'}->{'interactionList'}->{'interaction'};
foreach my $int (@{$intList}) {
my $experiment_type = $int->{'experimentList'}->{'experimentDescription'}->{'interactionDetection'}->{'names'}->{'shortLabel'};
my $partList = $int->{'participantList'}->{'proteinParticipant'};
my ($p1,$p2);
foreach my $protPart(@{$partList}) {
if ($protPart->{'proteinInteractor'}->{'organism'}->{'ncbiTaxId'} eq "9606") { # select human proteins
if (!$p1) {
$p1 = $protPart->{'proteinInteractor'}->{'xref'}->{'primaryRef'}->{'id'};
}
else {
$p2 = $protPart->{'proteinInteractor'}->{'xref'}->{'primaryRef'}->{'id'};
}
}
}
print "$p1\$p2\n";
}
I put the file on a folder in desktop (mac) Then I open terminal and I invoke the program like perl myfile.pl
This is the error I get
Can't locate XML/Simple.pm in @INC (@INC contains: /Users/admin/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level /Users/admin/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0 /Users/admin/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/darwin-2level /Users/admin/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0 .) at myfile.pl line 3. BEGIN failed--compilation aborted at myfile.pl line 3.
After installing twig , now i get this error
Use of uninitialized value $MIPS_file in string at myfile.pl line 7.
Can't locate object method "XMLin" via package "XML::Twig" at myfile.pl line 7.