On Thu, 31 Jan 2002, Bryan C. Warnock wrote:
> print "There's a letter in here!\n" if (substr($pi, 0, 200) =~ /[a-z]/);
*shrug* I actually did think of that when I first proposed this;
doesn't substr make a fresh copy of the string? (I honestly don't know.)
What happens if you take a substring of a generator? Have you just "used
up" the first 200 characters? What if I the thing I'm matching on is
tied, and taking a substring of it has side effects?
Plus the fact that, folding this functionality into the regex
engine gives us an extra set of tools for doing optimizations with...if we
can determine that their pattern cannot match more than N characters, then
we can stop after N characters, without having to take substrs or such. I
assume we're going to have this ability in the RE for its own use...why
not make it directly available to the user?
Dave