#!/usr/bin/perl -w

use strict;
use warnings; 

# Put the file name in a string variable
# so we can use it both to open the file
# and to refer to in an error message
# if needed.
my $file = shift;

# Use the open() function to open the file.
unless(open FILE, $file) {
	# Die with error message 
	# if we can't open it.
	die "\nUnable to open $file\n";
}

# Tell Perl we want to read data as binary.
binmode(FILE);

# Get rid of the line separator.
# This allows us to read everything
# in one go.
undef $/;

# Read the entire file. If you don't want
# to read all of it at once, you need the
# read() subroutine.
my $contents = <FILE>;

print "Read " . length($contents) . " bytes\n";

# close the file.
close FILE;

