首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

小程序调不通,总报错,不知道错哪了

2013-07-01 
小程序调不通,总报错,不知道哪里错了use warningsuse strictmy $file1bionet.txtopen (FILE,$file1)

小程序调不通,总报错,不知道哪里错了
use warnings;
use strict;
my $file1='bionet.txt';
open (FILE,$file1) or die "cannot open the file($!)\n";
my @file=<FILE>;
my %rebase=parseREBASE(@file);
open (OUT,">outfile.txt") or die "cannot opent the file($!)\n";
print OUT "%rebase\n";
exit;

sub parseREBASE{
  my @rebasefile=@_;
  my $site='';
  my $name='';
  my $truesite='';
  my %rebase_hash=();
  foreach (@rebasefile){
    (1../Rich Roberts/) and next;
/^\s$/ and next;
my @fields=split(' ',$_);
$name=shift @fields;
$site=pop @fields;
$truesite=IubToRegexy($site);
$rebase_hash{$name}="$truesite";
  }
  return %rebase_hash;
}

sub IubToRegexy{
   my($site)=@_;
   my $realsite='';
   my %iub2character_class = (
    A => 'A',
    C => 'C',
G => 'G',
T => 'T',
R => '[GA]',
Y => '[CT]',
M => '[AC]',
K => '[GT]',
S => '[GC]',
W => '[AT]',
B => '[CGT]',
D => '[AGT]',
H => '[ACT]',
V => '[ACG]',
N => '[ACGT]',
);
   $site=~s/\^//g;
   for(my $i=0;$i<length($site);$i++){
    $realsite.=$iub2character_class{substr($site,$i,1)};
   }
   return $realsite;
} perl??小程序?报错
[解决办法]
你把use strict 去掉就可以了

热点排行