I can not wrap my head around an easy way of doing this. I have code and it works, there is just a lot of the code and it seems a bit on the repetative side. Here is the code:
%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"); } ...
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

In reply to Parsing/Comparing by mrras25

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.