Perl V3 bug: repeated tests

Dennis Cottel dennis at
Thu Oct 26 09:17:42 AEST 1989


There's a bug in Perl3.0, related, I think, to the new optimization
for repeated tests on the same variable.  Things quit working in
mysterious ways if you have a construction like:

	if ( $i = 1 ) {...}
	if ( $i = 2 ) {...}
	if ( $i = 3 ) {...}
	if ( $i = 4 ) {...}
	...

This breaks if you have 3 or more tests.  You can get around the
problem by doing something like:

	if ( $i = 1 ) {...}
	if ( $i = 2 ) {...}
$kludge++;
	if ( $i = 3 ) {...}
	if ( $i = 4 ) {...}
	...

to avoid having more than 2 tests in a row.

I have reported this to Larry Wall.

	Dennis Cottel  Naval Ocean Systems Center, San Diego, CA  92152
	(619) 553-1645      dennis at nosc.MIL      sdcsvax!noscvax!dennis



More information about the Comp.sources.bugs mailing list