Michael C. Toren on 20 May 2006 04:21:01 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

In perl v5.6.1, using an array slice disables some "use strict" functionality


(This is really a non-issue, as what it amounts to is a bug in perl v5.6.1
that was later corrected sometime before v5.8.4, but it was interesting to
track down, and I thought others may appreciated it.)

As a result of upgrading a machine from Debian Woody to Debian Sarge, my
perl package was upgraded from v5.6.1 to v5.8.4.  Soon afterwards, I noticed
that one of my nightly perl crontab entries was failing, yet no change to
the script had been made.  After reducing the code as much as possible, I
was able to discover the root cause:  when using an array slice with v5.6.1,
"use strict" no longer complains about using barewords as strings.  For
example, the following validates with "perl -c":

	use strict;
	()[0..0];
	my $foo = bar;

If the second line is removed, it no longer validates.  If the array slice
is replaced with another form of an array lookup, such as "[0]", or "[0,1]",
it no longer validates.  Perhaps more interesting, if the first two lines
are transposed, it *still* validates.

perl v5.8.4 correctly refuses to validate all of the above.

-mct
-
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**