in reply to Re^2: Preferred technique for named subroutine parameters?
in thread Preferred technique for named subroutine parameters?
#!/usr/bin/perl use strict; use warnings; use Benchmark qw(cmpthese); sub f{ my %hash = @_; my $value = $hash{foo}; } sub g{ my $hash_ref = shift; my $value = $hash_ref->{foo} } cmpthese ( -1 => { list => sub { f( foo => 1) }, ref => sub { g({foo => 1})}, } ); __END__ Rate ref list ref 693652/s -- -25% list 919951/s 33% --
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Preferred technique for named subroutine parameters?
by shmem (Chancellor) on May 23, 2009 at 11:30 UTC |