Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!athena.mit.edu!tytso From: tytso@athena.mit.edu (Theodore Y. Ts'o) Newsgroups: comp.sources.bugs Subject: Making perl 2.0 core dump Summary: Passing arrays to subroutines? Message-ID: <6670@bloom-beacon.MIT.EDU> Date: 14 Aug 88 01:30:43 GMT Sender: daemon@bloom-beacon.MIT.EDU Reply-To: tytso@athena.mit.edu (Theodore Y. Ts'o) Organization: Massachusetts Institute of Technology Lines: 45 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@athena.mit.edu Everybody playing the game; but nobody rules are the same!