home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / perl / 5525 < prev    next >
Encoding:
Text File  |  1992-08-26  |  1.2 KB  |  49 lines

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!usc!news!netlabs!lwall
  2. From: lwall@netlabs.com (Larry Wall)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: SEGV in perl
  5. Message-ID: <1992Aug27.004012.1427@netlabs.com>
  6. Date: 27 Aug 92 00:40:12 GMT
  7. References: <1992Aug25.185319.2532@bnlux1.bnl.gov>
  8. Sender: news@netlabs.com
  9. Organization: NetLabs, Inc.
  10. Lines: 36
  11. Nntp-Posting-Host: scalpel.netlabs.com
  12.  
  13. In article <1992Aug25.185319.2532@bnlux1.bnl.gov> gc@bnl.gov writes:
  14. : Why do beginners (like me) always cause trouble?
  15. : The following perl script causes perl to core dump with a SEGV on a Sun
  16. : running SunOS 4.1:
  17. : #!/bin/sh --  # wish i were perl
  18. : # set -vx
  19. : eval 'exec perl -d -S $0 ${1+"$@"}'
  20. :     if $running_under_some_useless_shell;
  21. : while (($key,$value) = each %ENV){
  22. :     print "$key";
  23. :     if ($key =~ /WAVE_.*/){
  24. :         delete $ENV{$key};
  25. :         print " deleted";
  26. :     };
  27. :     print "\n";
  28. : };
  29. : print "\nRecapitulating\n";
  30. : while (($key,$value) = each %ENV){
  31. :     print "$key\n";
  32. : }
  33. : And "perl -v" says:
  34. : This is perl, version 4.0
  35. :  
  36. : $RCSfile: perl.c,v $$Revision: 4.0.1.6 $$Date: 91/11/11 16:38:45 $
  37. : Patch level: 19
  38. :  
  39. : Can anyone enlighten me?
  40.  
  41. Yeah, the each() iterator is stoopid, and doesn't handle deleting
  42. the current element right.  Don't do that (yet).
  43.  
  44. Larry
  45.