in reply to Irregular expression evaluation
A hint of what is going on:
use warnings; use strict; use Data::Dumper; gf(); gf(); sub gf { my $ins1 = '4 A -4 C -4 B 1 D'; my @inserts; print "\nat the beginning: " . \@inserts . "\n"; print $ins1, "\n"; $ins1 =~ /[\d+-]+(?: \w ([\d+-]+)(?{print \@inserts, "\n"; push @i +nserts, $1}))*/g; print "\n" . join ' ', @inserts; }
This prints:
at the beginning: ARRAY(0x189126c) 4 A -4 C -4 B 1 D ARRAY(0x189126c) ARRAY(0x189126c) ARRAY(0x189126c) -4 -4 1 at the beginning: ARRAY(0x224fc8) 4 A -4 C -4 B 1 D ARRAY(0x189126c) ARRAY(0x189126c) ARRAY(0x189126c)
The push for the second pass pushed everything into the first array.
|
|---|