changed the perl so it creates output files and puts stdout in them