in reply to while or foreach?

Not really, functionally they do the same thing... however, I tend to use foreach more for list manipulation, and while more for things like reading filehandles. They pretty much do the exact same thing.