#!/usr/bin/perl

# file handles have no set prefix though Perl practice
# encourages upper case. A perl program will exit
# exit immediately if a file can't be opened and will 
# will not tell you if the file you want written to
# does not exist.


# Simple file file open. Sample.txt, a sample text file,
# needs to be in same directory.

$check = open FILE, "Sample.txt";

if ($check){
	print "File opened by program.\n";
		}
	
close FILE; 

print "\n";

#open with error detecting code....

$check = open FILE, "noFile.txt";

if (! $check){
print "Wrong file cited by program.\n";
} 


