home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / perl / 5309 < prev    next >
Encoding:
Internet Message Format  |  1992-08-13  |  1.1 KB

  1. Path: sparky!uunet!usc!news!netlabs!lwall
  2. From: lwall@netlabs.com (Larry Wall)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: Variable interpolation in formats
  5. Keywords: eval bug in formats
  6. Message-ID: <1992Aug14.005748.17894@netlabs.com>
  7. Date: 14 Aug 92 00:57:48 GMT
  8. References: <bmarlowe.713124273@ka>
  9. Sender: news@netlabs.com
  10. Distribution: usa
  11. Organization: NetLabs, Inc.
  12. Lines: 32
  13. Nntp-Posting-Host: scalpel.netlabs.com
  14.  
  15. In article <bmarlowe.713124273@ka> bmarlowe@ka.reg.uci.edu (Brett Marlowe) writes:
  16. : There seems to be a bug (feature?) in argument evaluation of formats
  17. : in perl 4.019.  Variables are interpolated from the caller's package
  18. : but the same variable not in a string get evaluated in the format's
  19. : package.  Seems to me it should be more consistent. Here's a
  20. : demonstration program:
  21. : $main'foo = "bug!";
  22. : $test'foo = "demo";
  23. : $~="test'a";
  24. : write;
  25. : $~="test'b";
  26. : write;
  27. : package test;
  28. : format a=
  29. : This prints demo: @<<<<
  30. : $foo
  31. : .
  32. : format b=
  33. : This prints bug: @<<<<
  34. : "$foo"
  35. : .
  36.  
  37. Yep, it's a bug.  Fixed in 5.0, if not sooner.
  38.  
  39. Larry
  40.