samedi 24 janvier 2015

Split function usage in perl

I am new to perl, started learning few weeks before. I was using split function to split the $line by '|' and i want to check the protein name which is $val[2] after spliting! when I print its giving correct element but when I use it in if statement, even the given condition is false its giving yes. Pls tell me whats the mistake


#!/usr/bin/perl


$line = ">sp|P01011|AACT_HUMAN| Alpha-1:-antichymotrypsin: OS=Homo sapiens GN=SERPINA3 PE=1 SV=2";


my @val = split(/\|/, $line);


print " $val[2]\n";


if($val[2] == 'gh')


{


print " \n yes\n";


}


else


{


print "no";


}


Aucun commentaire:

Enregistrer un commentaire