disulfidebond has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use bignum; # pseudocode # print "Enter number of counts" # $ct = <>; # @arr = (); # for ($i = 0; $i < $ct; $i++) { # each iteration of loop calls subroutine # to get cell counts from user and stores in variable # push() variable to store in array # $count_i = &indiv_count() # push (@arr, $count_i); # } # output @arr # $arr_len = @arr; # print "The counts were:\n"; # for ($j = 0; $j< $arr_len; $j++) { # print "Count number $j was arr[$j]\n"; # } print "Enter number of counts.\n->"; my $ct = <>; chomp $ct; print "\n$ct"; @arr = (); for ($i = 0; $i < $ct; $i++) { my $count_i = &indiv_count(); push (@arr, $count_i); } $arr_len = @arr; print "The counts were:\n"; for ($j = 0; $j< $arr_len; $j++) { print "Count number $j was $arr[$j]\n"; } sub indiv_count { my ($input); print "Enter individual count from scope. Press Enter without inp +ut to end list\n"; @scope_ct = (); while ($input = <STDIN>) { chomp $input; last if ($input =~ /^\s*$/); push (@scope_ct, $input); } my $scope_ct = @scope_ct; for ($i=0; $i<$scope_ct; $i++){ $cell_sum += pop(@scope_ct); } $cell_ct = (($cell_sum/$scope_ct)/0.0000015); return $cell_ct; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Bug in code
by Kenosis (Priest) on Nov 19, 2012 at 22:31 UTC | |
|
Re: Bug in code
by frozenwithjoy (Priest) on Nov 19, 2012 at 22:18 UTC | |
|
Re: Bug in code
by graff (Chancellor) on Nov 20, 2012 at 03:48 UTC | |
|
Re: Bug in code
by linuxkid (Sexton) on Nov 20, 2012 at 01:57 UTC |