Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Legacy Code

by GotToBTru (Chaplain)
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
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 (Monsignor) 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 taking refuge in the Monastery: (10)
As of 2014-08-21 12:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (134 votes), past polls