代码如下:
#!/usr/bin/perl
# reading protein sequence data from a file
#First we have to open file and associate a "filehandle" with it, we choose the
#filehandle PROTEINFILE for readability.
open(PROTEINFILE, "pep.txt");
#first line
$protein=<PROTEINFILE>;
#print the protein onto the screen
print ("$protein");
#second line
$protein =<PROTEINFILE>;
#print the protein onto the screen
print ("$protein");
#third line
$protein =<PROTEINFILE>;
#print the protein onto the screen
print ("$protein");
#now we can close the file
close (PROTEINFILE);
#代码应该没多大问题,在CMD上运行的结果显示如图