The main script:
#!/usr/bin/perl
#Perl will search for packages in the current directory push(@INC,'.');
#I load the package Covertcsv
use Convertcsv;
#I create a new object Convertcsv
$obj=Convertcsv->new();
#I call the method csv2fasta
$obj->csv2fasta("a.txt","b.fasta");
And the package Convertcsv.pm:
#!/usr/bin/perl
#this is the package Convertcsv
package Convertcsv; use strict;
#constructor
sub new{
my $this={};
bless $this;
return $this;
}
#method
sub csv2fasta{
my $this = shift;
my($file_input,$file_output)=@_;
#code to convert the files
}
After all it is easy to work with objects in Perl too! :)
No comments:
Post a Comment