in reply to Re: nested reg ex over multiple lines
in thread nested reg ex over multiple lines
use strict; use warnings; use Data::Dumper; my $content = ""; my ($key, %data); while (<DATA>) { if ( $_ =~ /^CALCON\((\w+)\)/ ) { $key = $1; } else { if ( $_ =~ /^\s+(\w+)\(([\w\d\s]+)\)/ ) { $data{$key}->{$1} = $2 ; } } } print Dumper(\%data); __DATA__ CALCON(test1) { TYPE(U8) FEATURE(DCOM) NAM(stmin) LABEL(Min seperation time between CFs) MIN(0) MAX(127) UNITS(ms) } CALCON(test2) { TYPE(U16) FEATURE(DCOM) NAM(dcomc_sestmr_timeout) LABEL(DCOM Session Timer Timeout) MIN(0) MAX(65535) UNITS(ms) }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: nested reg ex over multiple lines
by holli (Abbot) on Jun 20, 2005 at 13:52 UTC | |
|
Re^3: nested reg ex over multiple lines
by BUU (Prior) on Jun 20, 2005 at 17:33 UTC |