0
這是SeqIO.pmperl的OOP通過可變
package SeqIO;
use strict;
use Carp;
use warnings;
use vars('@ISA');
use vars('@EXPORT_OK');
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(readSeq writeSeq);
sub readSeq {
my ($var1)= @_;
print "$var1\n";
open IN, '<$var1' or die "Cannot open file : $!";
while(<IN>) {
chomp $_;
print "$_\n";
}
close IN
}
sub writeSeq {}
sub new {
my $this = {};
bless $this;
return $this;
}
1;
Test.pl調用SeqIO.pm
use strict;
use SeqIO;
use warnings;
my $path_fasta=q/D:\360Downloads\A1.fasta/;
my $seqio = new SeqIO;
$seqio->readSeq($path_fasta);
但是當我使用readSeq它顯示用法類似於SeqIO = HASH(0x38ba34),什麼錯?
除了。 – ikegami