#!/usr/bin/perl -w use strict; my $Open_Ok; if (open (FILE,"file.txt")) { $Open_Ok = "ok"; } else { $Open_Ok = "not ok"; } print "$Open_Ok\n";