Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: For loop problem

by tommyw (Hermit)
on Nov 28, 2002 at 14:52 UTC ( [id://216311]=note: print w/replies, xml ) Need Help??


in reply to For loop problem

In essence, you're starting at the top of the file, and then just repeating 10 times: read from the current position to the end of the file. After the first time through the loop, you've reached the end of the file (by the nature of your while loop), so the subsequent iterations simply read from the end of the file to the end of the file. Which results in nothing happening. I suspect you need to add last after sending the line to NEW_OUTPUT_XML_A

To add to the confusion: $line=~/^(\d{1,10})/) looks for a line starting with a number of up to ten digits. Which you then attempt to compare with value of $d. But that's only a single digit (1 to 9), so the vast majority of the time, that's not going to work. Why not look for a line starting with only a single digit? $line=~/^(\d)\D/?

--
Tommy
Too stupid to live.
Too stubborn to die.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://216311]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (1)
As of 2024-04-25 19:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found