Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Problem with while loop inside a foreach loop

by choroba (Canon)
on May 03, 2013 at 11:47 UTC ( #1031870=note: print w/ replies, xml ) Need Help??


in reply to Re: Problem with while loop inside a foreach loop
in thread Problem with while loop inside a foreach loop

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";
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re^2: Problem with while loop inside a foreach loop
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (14)
As of 2015-07-31 09:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (276 votes), past polls