perlでpeptideを記入したファイルを読み込んでシェルに表示させるプログラムを書いた♪



$ vim 110305_test.pep

a
  1 DDKLEGLFLKCGGIDEMQSS

Esc

;wq

$ vim 110305_test.perl

a

  1 use strict;
  2 use warnings;
  3
  4 #Reading protein sequence data from a file
  5
  6 #The filename of the file containing the protein sequence data
  7 my $proteinfilename = '110305_test.pep';
  8
  9 #First we have to #open" the file, and associate
 10 #a "filehandle" with it. We choose the filehandle
 11 #PROTEINFILE for readability.
 12 open(PROTEINFILE, $proteinfilename);
 13
 14 #Now we do the actual reading of the protein sequence data fromj the file,
 15 #by using the angle brackets <and> to get teh input from the
 16 #filehandle. We store the data into our variable $protein.
 17 my $protein = <PROTEINFILE>;
 18
 19 #Now that we've got our data, we can close the file.
 20 close PROTEINFILE;
 21
 22 #Print the protein onto the screen
 23 print "Here is the protein:\n\n";
 24
 25 print $protein;

Esc
:wq

$ perl 110305_test perl
Here is the protein:

DDKLEGLFLKCGGIDEMQSS

うん。美しい♪♪