Path: utzoo!news-server.csri.toronto.edu!bonnie.concordia.ca!ccu.umanitoba.ca!herald.usask.ca!alberta!ubc-cs!uw-beaver!cornell!llenroc!batcomputer!rpi!usc!jarthur!bridge2!cook.ESD.3Com.COM!marcl From: marcl@ESD.3Com.COM (Marc Lavine) Newsgroups: comp.lang.perl Subject: Perl 4.0.beta problems with undef Message-ID: Date: 14 Mar 91 03:29:36 GMT Sender: news@bridge2.ESD.3Com.COM Lines: 63 Nntp-Posting-Host: cook.esd.3com.com I've found that using "undef" on an element of an associative array can cause Perl 4.0.beta to dump core (not neccessarily immediately). I'm enclosing a short script (albeit somewhat strange) that should allow others to confirm this. I've run it on a SPARCstation SLC under SunOS 4.1.1. This script does not dump core under Perl 3.0.37 or 3.0.44. Marc Lavine #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'undef.bug.pl' <<'END_OF_FILE' X#!/usr/local/bin/perl X# X# Demonstrate a bug in Perl 4.0.beta. X# This script works fine under Perl 3.0.37 and 3.0.44. X# Under 4.0.beta, Perl dumps core. X# X X$count = 2; X Xwhile ( $count-- ) X { X open ( INPUT, "undef.bug.pl" ); X X while ( ) X { X $lines { $counter++ } = $_; X undef $lines { $counter }; X } X X while ( --$counter ) X { X undef $lines { $counter }; X } X X close ( INPUT ); X } END_OF_FILE if test 403 -ne `wc -c <'undef.bug.pl'`; then echo shar: \"'undef.bug.pl'\" unpacked with wrong size! fi chmod +x 'undef.bug.pl' # end of 'undef.bug.pl' fi echo shar: End of shell archive. exit 0 -- Marc Lavine Broken: marcl%3Com.Com@sun.com Smart: marcl@3Com.Com UUCP: ...{sun|decwrl}!3Com.Com!marcl