[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] passwd file fwacking



On Thu, Apr 13, 2000 at 03:30:49PM -0400, Jeff Pinyan wrote:
> >	my %passwd = map { $_->[0] => $_ } map { [ split /:/ ] }
> >		IO::File->new("<$passwd")->getlines;
> >	my %shadow = map { $_->[0] => $_ } map { [ split /:/ ] }
> >		 IO::File->new("<$shadow")->getlines;
> >	$passwd{$_}->[1] = $shadow{$_}->[1] for keys %passwd;
> >	print join(':', @{$_}) for values %passwd;
> 
> Speed up your program with a unary + and map(EXPR,LIST):
> 
>   my %passwd = map +($_->[0] => $_), map [ split /:/ ],
>     IO::File->new("<$passwd")->getlines;
>   my %shadow = map +($_->[0] => $_), map [ split /:/ ],
>     IO::File->new("<$shadow")->getlines;

I see no noticeable difference in a simple Benchmark of map EXPR vs map
BLOCK.  Do you have an example that demonstrates your claim?

Ronald

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe