# I am running with perl -w && strict BTW sub read_file_or_handle { my $file_or_handle = shift; chomp $file_or_handle; unless(open FH, $file_or_handle ) { no strict q(refs); *FH = *file_or_handle; } while () { ... } close FH; # closes it no matter what is was, right? # return something I read }