home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!elroy.jpl.nasa.gov!usc!news!netlabs!lwall
- From: lwall@netlabs.com (Larry Wall)
- Newsgroups: comp.lang.perl
- Subject: Re: SEGV in perl
- Message-ID: <1992Aug27.004012.1427@netlabs.com>
- Date: 27 Aug 92 00:40:12 GMT
- References: <1992Aug25.185319.2532@bnlux1.bnl.gov>
- Sender: news@netlabs.com
- Organization: NetLabs, Inc.
- Lines: 36
- Nntp-Posting-Host: scalpel.netlabs.com
-
- In article <1992Aug25.185319.2532@bnlux1.bnl.gov> gc@bnl.gov writes:
- : Why do beginners (like me) always cause trouble?
- :
- : The following perl script causes perl to core dump with a SEGV on a Sun
- : running SunOS 4.1:
- :
- : #!/bin/sh -- # wish i were perl
- : # set -vx
- : eval 'exec perl -d -S $0 ${1+"$@"}'
- : if $running_under_some_useless_shell;
- : while (($key,$value) = each %ENV){
- : print "$key";
- : if ($key =~ /WAVE_.*/){
- : delete $ENV{$key};
- : print " deleted";
- : };
- : print "\n";
- : };
- : print "\nRecapitulating\n";
- : while (($key,$value) = each %ENV){
- : print "$key\n";
- : }
- :
- : And "perl -v" says:
- :
- : This is perl, version 4.0
- :
- : $RCSfile: perl.c,v $$Revision: 4.0.1.6 $$Date: 91/11/11 16:38:45 $
- : Patch level: 19
- :
- : Can anyone enlighten me?
-
- Yeah, the each() iterator is stoopid, and doesn't handle deleting
- the current element right. Don't do that (yet).
-
- Larry
-