On Sun, Aug 03, 2003 at 01:37:16AM +0200, Abigail wrote:
> I am fond of doing
> 
>     local %_ = @_;
> 
> as one of the first statements of a subroutine. That, or 
> 
>     my %args = @_;
> 
> I like the latter because it uses a lexical variable, but I like the
> former because %_ fits with @_ and $_.

FWIW, local() is quite a bit slower than my().

$ perl5.8.1 local_vs_my 1000000
          Rate local    my
local 180180/s    --  -30%
my    257069/s   43%    --

$ cat local_vs_my
#!/usr/bin/perl -w

use Benchmark 'cmpthese';

cmpthese( shift || -3, {
    local       => sub { local %_ = @_; },
    my          => sub { my %args = @_; },
});


-- 
Welcome to the Office Of Naval Contemplation

Reply via email to