#!/usr/bin/perl -w

use Error ':try';

try {
	open FILE, "<file.dat" or die "file.dat cannot be opened: $!";
	while (<FILE>) {
		# Do something
	}
	close FILE;
} catch Error::Simple with {
	my $err = shift;
	print "ERROR: $err";
};

print "Program terminates successfully.\n";
