Eric on 20 May 2006 13:33:48 -0000


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

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


On Saturday 20 May 2006 12:17 am, Michael C. Toren wrote:
> (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
> -

That't quite interesting!  Out of intense curiosity, what does $foo 
contain after the third line is executed under 5.6.1?  "bar" or the 
contents of $bar or something else?  

Eric
-- 
------------------------------------------------------------------------
#  Eric A Lucas
#  ------------
#   "Oh, I have slipped the surly bond of earth
#    and danced the skies on laughter-silvered wings... 
#        -- John Gillespie Magee Jr.
-
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**