package Whatever; use My::Logger qw< setLogLevel >; setLogLevel( STDOUT => 1 ); open LOG, '>>', 'some.log' or die; setLogLevel( LOG => 2 ); #### my( $arg )= @_; my $fh; if( ref( $arg ) ) { $fh= $arg; } elsif( "GLOB" eq $arg ) { $fh= \$arg; # or $fh= *{$arg}{IO}; } else { # It is a plain string. If you want to # treat it as the name of a glob, then # you'll need to check for /::|'/ and # prepend caller().'::', unless it is # special like 'STDOUT'. # You'll also need 'no strict;' here. ... }