Interestingly, things start working again at 999. i.e.
m/$mystrings[998]/; # Fails
m/$mystrings[999]/; # Works
m/$mystrings[1000]/; # Works
Deparse shows it's indeed parsed differently, but doesn't show why:
> perl -MO=Deparse x
Global symbol "$mystrings" requires explicit package name at x line 10
+.
x had compilation errors.
use strict 'refs';
my(@mystrings) = 'string' x 200;
$mystrings[99];
"$mystrings[100]";
/$mystrings[999]/;
/${'mystrings'}[998]/;
Update: These values also work: 111, 222, 333, 444, 555, 666, 777, 888. And apparently above 1000 it's not simple either. The first working ones after 1000 are: 1110, 1111, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1131, 1141, 1151, 1161, 1171, 1181, 1191, 1311, 1333, 1411
Overall, there's 393 values from 0 to 10,000 for which it works. The rest fail.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.