in reply to Can someone tell me why this hangs??
It looks like you might have an infinite loop in your code. Based on the condition for your while loop, you need $currentpos to be incremented each time through the loop. However, you're line of code to increment that variable is inside an if statement. Should you ever hit a condition when that if statement evaluates to be false, your while loop will continue forever.
I'd recommend modifying you code to move the incrementing line out of the if statement like the following:
if ($recordtype eq '$') { print " record type: $recordtype\n"; print " data: $fragment\n"; } #Inrement starting position for the next loop $currentpos += $recordlength;
|
|---|