mrras25 has asked for the wisdom of the Perl Monks concerning the following question:
The second "if" statement goes on for 13 columns... Question is there a shorter (code wise) to do this repetative code? Some columns are numbers some is ASCII. And the varibles do not have to be set that way, they could be a generic variable with a number if it makes the code shorter. Thank you, Robert%new_sect= buildhash('sect'); %h_srf = buildhash('rf'); #### Start comparing! while(<OSS>) { chomp; s/\015//g; ### Split OSS file my($cellsiteID,$sectID,$mcc,$mnc,$lac,$ci,$bscid,$bts, $bearing,$mscID,$lat,$long,$tilt,$agl) = (split /,/, $_ ); ### Set new varibles for reports or build of new scout! my($s_cellsite,$s_sectid,$s_mcc,$s_mnc,$s_lac,$s_ci,$s_bscid, $s_bts,$s_bearing,$s_mscid,$s_lat,$s_long,$s_tilt,$s_agl); if(exists $h_ssect{$cellsiteID."_".$sectID}) { my (@scoutSA,@scoutRA); my $change = 0; chomp(@scoutSA = split(/,/,$h_ssect{$cellsiteID."_".$sectID}) +); chomp(@scoutRA = split(/,/,$h_srf{$cellsiteID})); if($mcc !~ /^$scoutSA[$ocfg{'oss2.primpos'}]$/) { $change++; $s_mcc = $mcc; push(@{$chged{$cellsiteID."_".$sectID} }, $mcc,$scoutSA[$ocfg{'oss2.primpos'}] ); } else { $s_mcc = $scoutSA[$ocfg{'oss2.primpos'}]; push(@{$chged{$cellsiteID."_".$sectID}}, "NULL","NULL"); } ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing/Comparing
by duff (Parson) on Mar 10, 2006 at 19:30 UTC | |
by mrras25 (Acolyte) on Mar 10, 2006 at 20:23 UTC |