http://qs321.pair.com?node_id=430579


in reply to Re: Adding scalars but with a twist..
in thread Adding scalars but with a twist..

Ok i'd love to, except there's about 500,000 lines of code previously written by someone else. (badly). Trust me this is not the way i'd normal write things but am forced to..
Unfortunately whoever wrote this previously was terrible and it's just easier to keep running along thier lines, the reasons i'm asking the questions is i would never write a program like this but have to as small additions are being made.

I.e. everywhere through the code it has $Sel1Ttl + $Sel2Ttl......$Sel80Ttl already written..

Now everyone in thier answers has concentrated on the addition of the values, where the real problem is the $SelMaking this number changeTtl part...
  • Comment on Re^2: Adding scalars but with a twist..

Replies are listed 'Best First'.
Re^3: Adding scalars but with a twist..
by Jenda (Abbot) on Feb 13, 2005 at 20:36 UTC

    I guess some heavy refactoring is needed then. Should not be that hard to search&replace all the /\$Sel(\d+)Ttl\b/ with "$SelTtl\[$1]". Of course you should then go and replace those insane $Sel1Ttl + $Sel2Ttl......$Sel80Ttl, by sum(@SetTtl) (from List::Util), but that's something that can wait if necessary.

    Jenda
    We'd like to help you learn to help yourself
    Look around you, all you see are sympathetic eyes
    Stroll around the grounds until you feel at home
       -- P. Simon in Mrs. Robinson

Re^3: Adding scalars but with a twist..
by holli (Abbot) on Feb 13, 2005 at 15:44 UTC
    except there's about 500,000 lines of code
    In a single script? Assuming an average length of 40 Bytes per line that would be 19 MB!


    holli, /regexed monk/
      about 12Mb, it's awful!
        $ tar orgAuthor $ feather -chicken orgAuthor.tar
        ;-)


        holli, /regexed monk/