in reply to Help on multiline regex
my %objects; my $object; while (<>) { chomp; if ( my ($object_type, $object_id) = /^\s*object-group\s+(\S+)\s+(\S+)/ ) { $objects{$object_id} = $object = { type => $object_type, entries => [], }; } elsif (my ($entry) = /^\s*\S+-object\s+(.*)/) { push @{ $object->{entries} }, $entry; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help on multiline regex
by LanX (Saint) on Jun 01, 2011 at 18:05 UTC | |
by ikegami (Patriarch) on Jun 01, 2011 at 18:40 UTC | |
by LanX (Saint) on Jun 01, 2011 at 18:50 UTC | |
by ikegami (Patriarch) on Jun 01, 2011 at 19:17 UTC | |
by Anonymous Monk on Jun 02, 2011 at 00:30 UTC |