lexical-filehandle

Perl: How to pass and use a lexical file handle to a subroutine as a named argument?

I want to pass a lexical file handle to a subroutine using a named argument, but the following does not compile: #!/usr/bin/perl -w use strict; my $log_fh; my $logname = "my.log"; sub primitive { my ($fh, $m) = @_; print $fh $m; } sub sophisticated { my ($args) = @_; print $args->{m}; print $args->{fh} $args->{m} ; } ...