Download presentation
Presentation is loading. Please wait.
1
while(<FILE>){
if($_ =~ /^A/){ print $_; } if($_ =~ /t..e/){ if($_ =~ /[st].....[a-z][a-z]/){ print $_; if($_ =~ /[acgt]/){ print $_; }
2
#!/usr/bin/perl $seq = “aaaatttt”; $seq =~ s/a/T/g; print “$seq\n”; $seq =~ s/t/A/g;
3
配列変数 $name1 = “Thomas”; $name2 = “John”; $name3 = “Angela”;
$name4 = “Joanna”; @name = ( “Thomas”, “John”, “Angela”, “Joanna”); print $name[1]; for($i = 0;$i <= 3;$i ++){ print “$name[$i] “; } foreach $person print “$person “; }
4
ハッシュ キー → 値 $english{ “Ringo” } = “Apple”;
$english{ “Budo” } = “Grape”; $english{ “Ichigo” } = “Strawberry”; print $english{ “Budo” }; $ハッシュ名{ “キー” } = 値; %english = (“Ringo” => “Apple”, “Budo” => “Grape”, “Ichigo” => “Strawberry”);
5
関数 sub print_author { print “*****************************************\n”; print “ This work was done by Yukichi Fukuzawa\n”; print “ Last update: 2003/10/5\n”; } &print_author; 関数の定義 sub 関数名{ 処理 } &関数名
6
関数 sub print_author { my $author_name = $_[0];
print “*****************************************\n”; print “ This work was done by “, $author_name, “\n”; print “ Last update: 2003/10/5\n”; } &print_author(“Yukichi Fukuzawa”); # 関数中で$_[0]に入る &print_author(“Shigenobu Okuma”); # 関数中で$_[0]に入る 関数の定義 sub 関数名{ 処理 } &関数名
Similar presentations
© 2024 slidesplayer.net Inc.
All rights reserved.