Update: edited line of code. my ($type, $key) = /\A (\S+) (\S+)$/m;#!/usr/bin/perl use strict; use warnings; use 5.012; use Data::Dumper; my %data; { local $/ = 'object-group'; while (<DATA>) { chomp; next unless $_; my ($type, $key) = /\A (\S+) (\S+)$/m; my @data = /^ $type-object (.+)$/mg; $data{ $key } = {type => $type, array_of_entries => \@data}; } } print Dumper \%data; __DATA__ object-group service DM_SERVICE_7 service-object tcp eq 1433 service-object tcp eq 49160 service-object tcp eq 8086 object-group network Employees description Employees network-object 10.10.12.0 255.255.255.0 network-object 10.11.12.0 255.255.255.0
In reply to Re: Help on multiline regex
by Cristoforo
in thread Help on multiline regex
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |