#!/usr/bin/perl open(my $handle1, "<", "/tmp/1") or die "Input file does not exist.\n"; # Case 2 -- fails GetFileContents($handle1); close($handle1); sub GetFileContents { my $foo = shift; print "Function hash:\n"; { local($/); print <$foo>; } }