To write to a file:
open(FH, ">file") or die "Can't open file: $!\n"; print FH "this is a test.\n"; print FH "a test.\n";