#!/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 input to end list\n"; @scope_ct = (); while ($input = ) { 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; }