in reply to infinite loop on while (@array)

Does anyone know if while loops could be used like this

Yes, but that code fragment won't do what you expect.

There are lots of ways to do things in Perl. Please say more about what, exactly, you're trying to do.