in reply to Filehandle opened only for output error

Exactly what it says. You open the handle $ARCHIVO for writing, then you attempt to read from it.

If you want to open it for reading, use '<' instead.