in reply to Running a subroutine a certain number of times
use strict would have caught this and many other problems in your code. Incidently, if the three variables at the top of your code are constant, if would declare them as:$number_of_sequences=12; $max_length=50; $min_length=30; my @set; for (my $i=0; $i < $number_of_sequences;$i++) { my $aminoseq = genseq($aminoseq); print "$aminoseq\n\n"; push (@set,$aminoseq); } sub genseq { my $leg=randomlength(); my $seq; for (my $i=0; $i<$leg; $i++) { $seq.=randomaminoacid(); } return $seq; }
That way it is clear that they are constants, and it is impossible to inadvertently change them.use const NUMBER_OF_SEQUENCES => 12; use const MAX_LENGTH => 50; use const MIN_LENGTH => 30;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Running a subroutine a certain number of times
by davorg (Chancellor) on Aug 05, 2002 at 15:11 UTC | |
by dreadpiratepeter (Priest) on Aug 05, 2002 at 15:34 UTC |