in reply to Problem with while loop inside a foreach loop

Must be a similar issue like here Strange Global Array issue.

  • Comment on Re: Problem with while loop inside a foreach loop

Replies are listed 'Best First'.
Re^2: Problem with while loop inside a foreach loop
by choroba (Cardinal) on May 03, 2013 at 11:47 UTC
    Exactly. Looping over the file content the value of $_ is modified, which modifies the elements of @floors. The last value is undef (read at each file's end), so @floors ends up containing undefs after going through building1. Try adding the following line after the beginning of the foreach (@floors) loop:
    warn "FLOORS: @floors.\n";
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ