You don't need an explicit function to mark the end of a file. The following will loop through the lines of the file. When the end of the file is reached, you'll exit the loop so you can display your end-of-file message immediately after the loop.
#!/usr/local/bin/perl
use warnings;
use strict;
my $filename = 'your_file';
open my $filehandle, '<', $filename or die $!;
while (my $line = <$filehandle>) {
print $line;
}
print "End of File!\n";