accept string or filehandle