my $file_path = '/some/path/file.txt'; open my $fh, '<', $file_path or die "Impossible read from [$file_path]! $!"; # read the file and close it as soon as you do not need it anymore close $fh or die "error closing filehandle! $!";