#!/mit/watchmaker/vaxbin/perl
eval "exec /usr/local/perl -S $0 $*"
    if $running_under_some_shell;
			# this emulates #! processing on NIH machines.
			# (remove #! line above if indigestible)

$foo[0] = 4;
$foo[1] = 6;
$foo[2] = 13;
$foo[3] = 17;

do Bargraph("foo", @foo, 0, $#foo, 1, 0, 20, 1);

# This subroutine does bar graphs....
# Usage is as follows:
#
# do Bargraph($title, @array, $x_min, $x_max, $x_step, 
#			      $y_min, $y_max, $y_step)

sub Bargraph {
	local ($title, @array, $x_min, $x_max, $x_step,
			       $y_min, $y_max, $y_step) = @_;
	local($x, $y);

	for ($y=$y_max; $y < $y_min; $y += $y_step) {
		for ($x=$x_min; $x < $x_max; $x += $x_step) {
			if ($array[$x] <= $y) {
				print " ";
			} else {
				print "#";
			}
		}
		printf(" %2d\n", $y);
	}
}
