Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Took me some staring and blinking until I noticed what the regex was doing with the \G but no /g despite a loop. This is clearer:

    my $regex = qr/(\G[abcd]{0,4}(?{push @perms => [$&,$']}))/ x 4;

    It might be personal bias that I hate doing string concatenations in a loop, but this seems to be a case where the x operator is a natural fit.

    (Your final regex isn't precompiled, btw. I don't know if you are aware of that.)

    I'm not sure the output I'm seeing either way is intended, though? It simply lists all possible ways to split this string, twice, but doesn't do what I'd expect when I hear “permutations.”