[SP-pm] Como testar conexões remotas?
Eden Cardim
edencardim at gmail.com
Sat Sep 18 07:11:53 PDT 2010
2010/9/18 Thiago Glauco Sanchez <thiagoglauco em ticursos.net>:
> %hash = map { get_a_key_for($_) => $_ } @array;
>
> é o mesmo que:
>
> %hash = ();
> foreach (@array) {
> $hash{get_a_key_for($_)} = $_;
> }
>
> aliás até os opcodes gerados pelo compilador serão praticamente os mesmos.
> Assim como for e foreach geram os mesmos opcodes.
Usar map é mais eficiente:
bjork:sandbox edenc $ perl -MO=Concise foreach.pl > foreach.out
foreach.pl syntax OK
bjork:sandbox edenc $ perl -MO=Concise map.pl > map.out
map.pl syntax OK
bjork:sandbox edenc $ wc foreach.out
39 203 1558 foreach.out
bjork:sandbox edenc $ wc map.out
31 159 1377 map.out
--
Eden Cardim Need help with your Catalyst or DBIx::Class project?
Code Monkey http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://blog.edencardim.com/ http://www.shadowcat.co.uk/servers/
More information about the SaoPaulo-pm
mailing list