Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Legacy Code

by GotToBTru (Vicar)
on Apr 01, 2011 at 15:26 UTC ( #896944=perlmeditation: print w/ replies, xml ) Need Help??

With apologies to Charles Schulz.
$nmbrvalues = 11; $position1 = 0; $position2 = 0; $linelength = length($linein); for ($cntr = 1; $cntr <= $nmbrvalues; $cntr++) { $position1 = $position2; $position1 = index($linein,'|',$position1); $position2 = index($linein,'|',$position1 + 1); $fldlength = $position2 - ($position1+1); if ($cntr == 1) {$hold1 = substr($linein,$position1+1,$fldlength);} if ($cntr == 7) {$hold2 = substr($linein,$position1+1,$fldlength);} if ($cntr == 8) {$hold3 = substr($linein,$position1+1,$fldlength);} if ($cntr == 9) { $position3 = $position1+1; $position3 = index($linein,'@',$position3); If ($position3 > 0) { if ($position2 < 0) {$position2 = length($linein);} $fldlength = $position2 - ($position1+1); $emailaddress = substr($linein,$position1+1,$fldlength); } #end of IF if ($position3 <= 0) {$emailaddress = "mgrs\@server.com";} } #end of if } #end of FOR
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
GGGGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHHH!


You may now resume your regularly scheduled Perlmonks browsing.



Update: corrected the misspelled name.

Comment on Legacy Code
Download Code
Replies are listed 'Best First'.
Re: Legacy Code
by repellent (Priest) on Apr 03, 2011 at 06:16 UTC
    Here, I've written the first test.

    Once you're done adding tests, you can modify foo() to your heart's content. The tests must still pass.
Re: Legacy Code
by holli (Monsignor) on Apr 03, 2011 at 13:02 UTC
    You gotta love the end block comments!


    holli

    You can lead your users to water, but alas, you cannot drown them.
Re: Legacy Code
by sundialsvc4 (Abbot) on Apr 04, 2011 at 17:44 UTC

    s/Schultz/Schulz/g

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://896944]
Approved by wazoox
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (17)
As of 2015-07-28 13:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (255 votes), past polls