java关闭文件句柄_关闭文件句柄上的readline() (readline() on closed filehandle)

2013-02-22 00:22:11

1

Running this code produces an error stating "readline() on closed filehandle SEQFILE at line 14." Previous searches have all commented on how one should put some type of conditional after open. Doing so just kills the program (i left it out so I could see why it didn't open). I would guess the deeper problem is why is it not opening my file?

#!/usr/bin/perl -w

#Ask user to point to file location and collect from the keyboard

print "Please specify the file location: \n";

$seq = ;

#Remove the newline from the filename

chomp $seq;

#open the file or exit

open (SEQFILE, $seq);

#read the dna sequence from the file and store it into the array variable @seq1

@seq1 = ;

#Close the file

close SEQFILE;

#Put the sequence into a single string as it is easier to search for the motif

$seq1 = join( '', @seq1);

#Remove whitespace

$seq1 =~s/\s//g;

#Use regex to say "Find 3 nucelotides and match at least 6 times

my $regex = qr/( ([ACGT]{3}) \2{6,} )/x;

$seq1 =~ $regex;

printf "MATCHED %s exactly %d times\n", $2, length($1)/3;

exit;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值