in reply to Irregular expression evaluation

This isn't at all related to your actual problem, but what's the /g for? The * is already getting all of your matches.

And you probably have this already if you're benchmarking, but I suspect /g probably is the right way to go:

use warnings; use strict; gf (); gf (); sub gf { my $ins1 = '4 A -4 C -4 B 1 D'; my @inserts; $ins1 =~ /^[\d+-]+/g; push @inserts, $ins1 =~ /\G(?: \w ([\d+-]+))/g; print join(' ', @inserts), "\n"; }

I work for Reactrix Systems, and am willing to admit it.

Replies are listed 'Best First'.
Re^2: Irregular expression evaluation
by GrandFather (Saint) on Oct 25, 2005 at 01:28 UTC

    Result of evolving code I suspect. Think of it as an appendix - most of the time it does no harm, but it has no obvious use. :)


    Perl is Huffman encoded by design.