sandy1028 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, In a directory I have files. The have read the files from the directory and each file there are sections which are considered as file. Suppose for first file as 3 sections then, The value should display as 1,2,3. Suppose the second file consists of 6 files, the value should display from 4,5,6,7,8 and 9. The problem is when threading is used, The values are displayed from 1,2,3 for first file and again from 1,2,3,4,5,6 for second file. The value is not continuous. Can you please tell me the reason why the value is printing from 1 when the new file starts. or similar examples or tutorials related to this problem.

Replies are listed 'Best First'.
Re: Display sequential
by apl (Monsignor) on Jan 16, 2009 at 13:20 UTC
    You're reinitializing your counter before you process each section of a file (you really shouldn't use the same word (file) to describe two different things). Move the initialization of the counter before you start processing a file, and everything should be okay.

    It's right there on line 32...

    Did you try debugging this in any way, shape or form? print statements should have revealed the problem immediately.

    BTW, if this is homework, you should go to your professor and ask for a tutor...

Re: Display sequential
by puudeli (Pilgrim) on Jan 16, 2009 at 11:59 UTC
    If you show some code, the monks may be able to help you.
    --
    seek $her, $from, $everywhere if exists $true{love};
Re: Display sequential
by Sandy (Curate) on Jan 16, 2009 at 15:33 UTC