#!/usr/bin/perl use strict; open my $f, ">", "output.txt" or die "Can't open the file: $!"; print $f "Hello file.\n"; close $f or die "Can't close the file: $!";