ckclark@athena.mit.edu (04/21/91)
A problem occurs when trying to replace tabs with spaces using the
invocation:
while (<>) {
1 while s/\t+/' 'x (length($&) * 8 - length($`) % 8)/e;
print;
}
(taken from the Gospel According to lwall, Chapter 3, pg. 105, footnote 31)
When I run it in 3.044, it works fine, but when I try it in 4.000 or
4.003, it acts as if length($`) is 0; i.e., as if $` is not bring set.
I have not seen anything in the documentation which indictates that this
behavior change is intentional. Am I missing something?
-Calvin
INTERNET ckclark@mit.edu
UUCP ...!mit-eddie!mit-athena!ckclark
BITNET Use a ouija board.
lwall@jpl-devvax.jpl.nasa.gov (Larry Wall) (04/23/91)
In article <1991Apr20.193701.17201@uvaarpa.Virginia.EDU> ckclark@athena.mit.edu writes:
: A problem occurs when trying to replace tabs with spaces using the
: invocation:
:
: while (<>) {
: 1 while s/\t+/' 'x (length($&) * 8 - length($`) % 8)/e;
: print;
: }
:
: (taken from the Gospel According to lwall, Chapter 3, pg. 105, footnote 31)
:
: When I run it in 3.044, it works fine, but when I try it in 4.000 or
: 4.003, it acts as if length($`) is 0; i.e., as if $` is not bring set.
:
: I have not seen anything in the documentation which indictates that this
: behavior change is intentional. Am I missing something?
No, you're right. There was a bug in 3.044 having to do with recursion
if the RHS called the subroutine containing the current substitution. In
fixing this, I managed to "unfix" $`. It will be fixed in patch 4.
Sorry. My testing organization is either too small, or too large, depending
on how you look at it. :-)
Larry