简体   繁体   English

如何在perl中阅读此代码?

[英]How do I read this code in perl?

I have a script that was given to me for a certain reason to use, which is written in perl, and I have no idea how to read in perl. 我有一个出于某种原因而使用的脚本,该脚本是用perl编写的,我不知道如何用perl读取。 The only modification that I need to make to this program in order to run it is to enter the corresponding file name that the program will be using into the script, but I have no idea where the file name is supposed to go. 为了对该程序进行运行,我需要对其进行的唯一修改是在脚本中输入该程序将使用的相应文件名,但是我不知道该文件名应该去哪里。 Can you help me out? 你能帮我吗?

I am assuming it's somewhere in one of these two blocks within the script: 我假设它在脚本的以下两个块之一中的某个位置:

die "usage : [fasta file] \n" unless (@ARGV);

OR here: 或者在这里:

sub read_fasta {
     my ($data, $file)= @_;
     open(FILE, "<",$file) or return 0;

The error message the script produces when you provide no arguments seems to indicate you should provide a file name as an argument. 当您不提供任何参数时,脚本生成的错误消息似乎表明您应该提供文件名作为参数。

./script file.fasta

The code confirms it. 代码确认。 The first of the script's arguments is moved into $genome , and passed to read_fasta which places it in $file , which it passes to open as the name of the file to open. 脚本的第一个参数移入$genome ,并传递给read_fasta ,将其放入$file ,并传递给open作为要open的文件名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM