home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!news!netlabs!lwall
- From: lwall@netlabs.com (Larry Wall)
- Newsgroups: comp.lang.perl
- Subject: Re: Variable interpolation in formats
- Keywords: eval bug in formats
- Message-ID: <1992Aug14.005748.17894@netlabs.com>
- Date: 14 Aug 92 00:57:48 GMT
- References: <bmarlowe.713124273@ka>
- Sender: news@netlabs.com
- Distribution: usa
- Organization: NetLabs, Inc.
- Lines: 32
- Nntp-Posting-Host: scalpel.netlabs.com
-
- In article <bmarlowe.713124273@ka> bmarlowe@ka.reg.uci.edu (Brett Marlowe) writes:
- :
- : There seems to be a bug (feature?) in argument evaluation of formats
- : in perl 4.019. Variables are interpolated from the caller's package
- : but the same variable not in a string get evaluated in the format's
- : package. Seems to me it should be more consistent. Here's a
- : demonstration program:
- :
- : $main'foo = "bug!";
- : $test'foo = "demo";
- :
- : $~="test'a";
- : write;
- :
- : $~="test'b";
- : write;
- :
- : package test;
- :
- : format a=
- : This prints demo: @<<<<
- : $foo
- : .
- :
- : format b=
- : This prints bug: @<<<<
- : "$foo"
- : .
-
- Yep, it's a bug. Fixed in 5.0, if not sooner.
-
- Larry
-