Hi guys
I have a file that looks like:
I have to parse this file and create a structure where
Object_class and Parameter name are the keys.
Below part of the code:
Condition to use in other sub-routine
I have re-used an old post from tek-tips for the reg exp. I am wondering if I can optimize it instead of use split function.
dmazzini
GSM/UMTS System and Telecomm Consultant
I have a file that looks like:
Code:
[WBTS]
RncId
WBTSId
template_name
template_set
ATMInterfaceID
COCOId
VCI
VPI
siteId
name
BTSAdditionalInfo
WBTSChangeOrigin
ManagedBy
UserDefinedState
status
last_modified
last_actual_import
[WCEL]
RncId
WBTSId
LcrId
template_name
template_set
CId
FachDataAllowedTotal
LAC
SAC
URAId1
URAId2
URAId3
URAId4
URAId5
URAId6
URAId7
URAId8
MaxNumbUECMcoverHO
name
CellAdditionalInfo
SACB
WCELChangeOrigin
status
last_modified
last_actual_import
[WCEL_AC]
RncId
WBTSId
LcrId
template_name
template_set
...
....
I have to parse this file and create a structure where
Object_class and Parameter name are the keys.
Below part of the code:
Code:
my %PARAM;
open IN, $default_parameters_to_exclude_file or die $!;
local $/ = "\n\n";
while (my $intext = <IN>) {
$intext = trim($intext); chomp $intext;
if ($intext =~ /^\[(\S+)\]\n(.*)/s) {
my ($objectclass,$parameters) = ($1,$2);
foreach my $parameter(split /\n/,$parameters){
$parameter =trim ($parameter);
chomp $parameter;
@{$PARAM{$objectclass}{$parameter}}=1;
}
}
}
close IN;
Condition to use in other sub-routine
Code:
if (defined (@{$PARAM{$objectclass}{$parameter}}){next};
I have re-used an old post from tek-tips for the reg exp. I am wondering if I can optimize it instead of use split function.
dmazzini
GSM/UMTS System and Telecomm Consultant