#!/usr/bin/perl my $handle1; open($handle1, "< /tmp/1") || die "Input file does not exist.\n"; # Case 1 GetFileContentsViaScalar(\*$handle1); close($handle1); sub GetFileContentsViaScalar { my $FH = shift; print "SHIFT:\n"; { local($/); print <$FH>; } } #### #!/usr/bin/perl my $handle1; open($handle1, "< /tmp/1") || die "Input file does not exist.\n"; # Case 2 -- fails GetFileContentsViaFnHash(\*$handle1); close($handle1); sub GetFileContentsViaFnHash { my %test; $test{FH} = shift; print "Function hash:\n"; { local($/); print <$test{FH}>; } }