On Thu, 10 Oct 2002 12:34:56 -0600 (MDT), Chris Staskewicz wrote (in part):

cjs> Thanks, the subroutine is very helpful for generating these substrings.
cjs> However, if I do:

[snipped]

cjs> @subs contains all the desired "green" substrings, but is NULL on the
cjs> next iteration of the loop.

[snipping down to my subroutine]

>       sub gen_substrs ($) {
>           my $str = shift;
>           my @s;
>           $str =~ /(.+?)(??{push @s,$1})(?!)/;
>           @s;
>       }

Yes, there's a bug in perl which I'd forgotten about when I sent that.
The 'use strict'-safe fix is to replace the 'my @s;' with this:

        my @s if 0;
        @s = ();

That exercises a different-but-related bug to keep the @s in the regexp
referring to the same one the subroutine itself uses.  Even if that bug in
(??{code}) blocks gets fixed, that construction should still work.  It may
not be safe with -w under 5.8.0, however.  (I seem not to have that version
installed here - I'm apparently using a 5.7.3 devel version.)

And now that I've been bitten by that particular bug personally, I'll have
to look into what it takes to fix it.  @whee.

        --s.

-- 
Spider Boardman (at home)                     [EMAIL PROTECTED]
The management (my cats) made me say this.    http://www.ultranet.com/~spiderb/
PGP public key fingerprint: 96 72 D2 C6 E0 92 32 89  F6 B2 C2 A0 1C AB 1F DC
Wie sagt mann "Charlie Foxtrot" auf Deutsch?
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to