What about named parameters?
sub doit { my %options = @_; if ($options{filename} ) { #use a filename } elsif ( $options{filehandle} ) { # use a filehandle } else { die "won't work"; } } doit( filename => 'somefile'); doit( filehandle => $fh );
In reply to Re: Accepting either a filename or a handle
by cchampion
in thread Accepting either a filename or a handle
by fizbin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |