in reply to Problem in Foreach loop

2 hints:

Check the contents of your @array. I suspect it does not contain what you think it should:

use Data::Dumper; print Dumper(\@array);

You never print out the lines of your input file which match your conditions. I expect to see print $_; somewhere inside your while loop. The name of your $line variable is confusing to me. I would have expected it to be a line of your input file, but it is an element of your poorly-named @array.

Replies are listed 'Best First'.
Re^2: Problem in Foreach loop
by cowboyrocks (Novice) on Apr 02, 2009 at 02:41 UTC
    I checked the array content with data dumper. Its correct
Re^2: Problem in Foreach loop
by cowboyrocks (Novice) on Apr 02, 2009 at 02:46 UTC
    Well as for $_ I am already using $1 and $2 match variables as per my if condition for $_
      Apologies if I am being particularly dense here but I still don't quite see what you are trying to achieve. When you say "I want to find breaks in 100's and then print those record names at the break points" what exactly do you mean and which fields (and which parts of those fields if applicable) are you trying to break on?
        Hi... I have updated the example now. I hope it makes things clear now. Thanks