【发布时间】:2016-02-01 23:13:33
【问题描述】:
我想编写一个脚本,该脚本将解析一个文件,提取它可以找到的所有 EC 编号(酶分类代码)并打印出一个列表。 EC 编号如下所示:EC 0.1.2.3 或 EC6.7.8.9
到目前为止,我的尝试都没有成功 - 现在它会打印出文件的全部内容。
#!/usr/bin/perl
use warnings;
use strict;
use diagnostics;
open (IN,"ec.txt") or die "Can't read words file: $!";
while (<IN>) {
chomp;
$_ =~ /EC?(\d+)\s*/g;
print("$_ \n");
}
【问题讨论】:
-
您不允许使用空格和点。
-
请添加一些示例输入和预期结果。