package MySequence2;

use strict;

# this module is a subclass of the "Exporter" module. 
# so it inherit properties (functions and variables) the "Exporter" module. 
use base 'Exporter';

# to export the functions reversec and seqlen automatically. 
# i.e., they are the default functions 
our @EXPORT = qw(reversec seqlen);

# it is OK for the user to import the $EcoRI variable, 
# but not to export it automatically
# i.e., it is the optional variable
our @EXPORT_OK = qw($EcoRI);

our $EcoRI = 'ggatcc';

sub reversec {
   my $sequence = shift;
   $sequence = reverse $sequence;
   $sequence =~ tr/gatcGATC/ctagCTAG/;
   return $sequence;
   }

sub seqlen {
   my $sequence = shift;
   $sequence =~ s/[^gatcnGATCN]//g;
   return length $sequence;
   }

1;