in reply to Scoping of my with foreach loop
Missing $ sigils aside: In the first example $item is visible outside and after the for BLOCK; in the second $item is only visible within the for BLOCK.