in reply to Re: Running a subroutine a certain number of times
in thread Running a subroutine a certain number of times
Also, you almost certainly don't need those old C-style for loops. and actually, you don't need those $i variables at all.
or even$number_of_sequences=12; $max_length=50; $min_length=30; my @set; foreach (0 .. $number_of_sequences) { my $aminoseq = genseq($aminoseq); print "$aminoseq\n\n"; push (@set, $aminoseq); } sub genseq { my $leg = randomlength(); my $seq; foreach (0 .. $leg) { $seq .= randomaminoacid(); } return $seq; }
--sub genseq { my $seq; $seq .= randomaminoacid() foreach 0 .. randomlength(); return $seq; }
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Running a subroutine a certain number of times
by dreadpiratepeter (Priest) on Aug 05, 2002 at 15:34 UTC |