Making perl 2.0 core dump

Michael Peterson mkp at luna.UUCP
Mon Aug 15 06:36:20 AEST 1988


In article <6670 at bloom-beacon.MIT.EDU> tytso at athena.mit.edu 
(Theodore Y. Ts'o) writes:
>I'm running perl 2.0 at patchlevel 13, and the following perl script
>causes it to core dump on a Vax....

[Original script... ]

Here's a script that works.

-------------------8<-------------------8<----------------------------------
#! /usr/bin/perl

# test case.
@foo = (4, 6, 3, 17);
do Bargraph("foo", 0, $#foo, 1, 0, 20, 1, @foo);

#
# This subroutine does bar graphs....
# Usage is as follows:
#
# do Bargraph($title, $x_min, $x_max, $x_step, 
#		      $y_min, $y_max, $y_step, @data)
sub Bargraph 
{
	local($x, $y);
	local($title = shift(@_));
	local($x_min = shift(@_));
	local($x_max = shift(@_));
	local($x_step = shift(@_));
	local($y_min = shift(@_));
	local($y_max = shift(@_));
	local($y_step = shift(@_));
	local(@data = @_);

	for ($y = $y_max; $y >= $y_min; $y -= $y_step) 
	{
		for ($x = $x_min; $x <= $x_max; $x += $x_step) 
		{
			$c = ($data[$x] <= ($y - 1)) ? " " : "#";
			print "$c";
		}
		printf(" %2d\n", $y);
	}
}


-- 
Michael K. Peterson		Internet: mkp at hac2arpa.hac.com
Space & Communications Group	UUCP: ....!{scgvaxd,hacgate.hac.com}!mkp
Hughes Aircraft Company
213 416-0323



More information about the Comp.sources.bugs mailing list