$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
You may now resume your regularly scheduled Perlmonks browsing.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Legacy Code
by GotToBTru (Prior) on Apr 06, 2022 at 12:25 UTC | |
Re: Legacy Code
by cavac (Prior) on Apr 06, 2022 at 19:12 UTC | |
Re: Legacy Code
by repellent (Priest) on Apr 03, 2011 at 06:16 UTC | |
Re: Legacy Code
by jdporter (Paladin) on Apr 06, 2022 at 18:19 UTC | |
Re: Legacy Code
by eyepopslikeamosquito (Archbishop) on Apr 07, 2022 at 01:55 UTC | |
Re: Legacy Code
by holli (Abbot) on Apr 03, 2011 at 13:02 UTC | |
Re: Legacy Code
by locked_user sundialsvc4 (Abbot) on Apr 04, 2011 at 17:44 UTC |