if (ref $param) { # it isn't a simple string, assume it is a filehandle $fh = $param; } else { open $fh, "<", $param or die "$param: $!"; }