in reply to While loop double counting

You are not initializing $count with my in the sub.

This way it becomes global and is never resetted.

Plz use strict to avoid such problems.

Cheers Rolf

( addicted to the Perl Programming Language)

Replies are listed 'Best First'.
Re^2: While loop double counting
by vihar (Acolyte) on Nov 23, 2013 at 05:01 UTC
    Never mind. I got it. Sorry for multiple replies. Thanks for your help and I will be sure to use strict from now on.
Re^2: While loop double counting
by vihar (Acolyte) on Nov 23, 2013 at 04:54 UTC
    Thanks for your reply. I am not sure if I am understanding it right. Do you mean add my in front of $ISCountForFile[$i] to make it
    my $ISCountForFile[$i] = &getISCount(@ISFiles[$i]);
    Thanks!
Re^2: While loop double counting
by vihar (Acolyte) on Nov 23, 2013 at 04:59 UTC
    I tried adding my for $count in sub but after that I don't get any numbers back. Thanks