JohnLucania
Programmer
#! /usr/bin/perl
use warnings;
use strict;
use CGI (':standard');
my $title = '1000 Sequences';
print header,
start_html( $title ),
h1( $title );
sub random_dna {
my $length = shift;
my @charlist = ( 'A' , 'C' , 'T', 'G' );
my $random;
$random .= $charlist[ int rand( @charlist ) ] for ( 1 .. 1000 );
return($random);
}
sub random_protein {
my $length = shift;
my @charlist = ('Ala', 'Arg', 'Asn', 'Asp', 'Cys', 'Gln', 'Glu', 'Gly', 'His', 'Ile', 'Leu', 'Lys', 'Met', 'Phe', 'Pro', 'Ser', 'Thr','Trp', 'Tyr', 'Val', 'Asx', 'Glx', 'Xaa');
my $random;
$random .= $charlist[ int rand( @charlist ) ] for ( 1 .. 1000 );
return($random);
}
my $q=new CGI;
my $dna=$q->param('Seq');
print random_dna() if $dna eq 'DNA';
print random_protein() if $dna eq 'Protein';
hr();
my $url = url();
my $seq = param( 'Seq' ) || 'unknown';
print start_form( -method => 'GET' , action => $url ),
p( "What sequence do you want: " . radio_group( -name => 'Seq' ,
-values => [ 'DNA' , 'Protein' ] )),
p( submit( -name => 'submit' , value => 'Submit' )),
end_form(),
end_html();
why are these errors showing up?
"my" variable $seq masks earlier declaration in same scope at ./DNAProteinSeq.cgi line 34.
Global symbol "$dna" requires explicit package name at ./DNAProteinSeq.cgi line 29.
Global symbol "$dna" requires explicit package name at ./DNAProteinSeq.cgi line 30.
jl
use warnings;
use strict;
use CGI (':standard');
my $title = '1000 Sequences';
print header,
start_html( $title ),
h1( $title );
sub random_dna {
my $length = shift;
my @charlist = ( 'A' , 'C' , 'T', 'G' );
my $random;
$random .= $charlist[ int rand( @charlist ) ] for ( 1 .. 1000 );
return($random);
}
sub random_protein {
my $length = shift;
my @charlist = ('Ala', 'Arg', 'Asn', 'Asp', 'Cys', 'Gln', 'Glu', 'Gly', 'His', 'Ile', 'Leu', 'Lys', 'Met', 'Phe', 'Pro', 'Ser', 'Thr','Trp', 'Tyr', 'Val', 'Asx', 'Glx', 'Xaa');
my $random;
$random .= $charlist[ int rand( @charlist ) ] for ( 1 .. 1000 );
return($random);
}
my $q=new CGI;
my $dna=$q->param('Seq');
print random_dna() if $dna eq 'DNA';
print random_protein() if $dna eq 'Protein';
hr();
my $url = url();
my $seq = param( 'Seq' ) || 'unknown';
print start_form( -method => 'GET' , action => $url ),
p( "What sequence do you want: " . radio_group( -name => 'Seq' ,
-values => [ 'DNA' , 'Protein' ] )),
p( submit( -name => 'submit' , value => 'Submit' )),
end_form(),
end_html();
why are these errors showing up?
"my" variable $seq masks earlier declaration in same scope at ./DNAProteinSeq.cgi line 34.
Global symbol "$dna" requires explicit package name at ./DNAProteinSeq.cgi line 29.
Global symbol "$dna" requires explicit package name at ./DNAProteinSeq.cgi line 30.
jl