in reply to How to save the output result in file

redirects the output into a file eg.
shell> perl scriptname.pl > output.txt