Making perl 2.0 core dump
Theodore Y. Ts'o
tytso at athena.mit.edu
Sun Aug 14 11:30:43 AEST 1988
I'm running perl 2.0 at patchlevel 13, and the following perl script
causes it to core dump on a Vax....
#!/mit/watchmaker/vaxbin/perl
$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);
}
}
What is the correct way of passing an array to a subroutine in Perl?
(Is there a way?). Even if I'm doing it wrong, it probably shouldn't
be core dumping.... which it does on the "local($title.....) = @_;".
I haven't had a chance to analyze what's going wrong; but if anyone
has a fix or workaround for the problem, I'd appreciate it.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Theodore Ts'o mit-eddie!mit-athena!tytso
3 Ames St., Cambridge, MA 02139 tytso at athena.mit.edu
Everybody playing the game; but nobody rules are the same!
More information about the Comp.sources.bugs
mailing list